Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro command: SaveReport - syntax error 1

Status
Not open for further replies.

ShaneSQ

Technical User
Nov 23, 2006
17
CA
I want a macro to save the report as an excel file but when i test the macro, it tells me there's a syntax error on the SaveReport line.

My macro script is as follows:

Sub saveasexcel()
Dim Sitenm as string
Dim Filename as String
Dim Num as variant

Sitenm = Field("site")

Filename = "C:\Documents\UDA-"+Sitenm

Num=2

SaveReport (Filename,Num)

End Sub

I've tried using:

SaveReport (Filename,2)

And I've tried using other data types for the variable "Num", but these only lead to a second error: "Type mismatch, parameter 1 in subprogram SaveReport"


What am I missing?

Any and all help greatly appreciated!
 
SaveReport (Filename,Num)

You are using the function format of the command. A function returns a value and needs a place to put it.

Try this:

x = SaveReport (Filename,Num)

or the non function syntax:

SaveReport Filename,Num


CharlesCook.com
Specializing in ReportSmith Training and Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top