Thread: Almost there
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Almost there

Sub test()

Dim Path As String

Path = "C:\Documents and Settings\Richard Sabbara\Desktop\"

With ActiveWorkbook
.SaveAs Filename:=Path & .Worksheets("Sheet1").Range("C1").Value &
".xls", _
FileFormat:=xlNormal, _
Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False
End With
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
I got help from the group last night in how to give the file a dynamic
file name using a macro, I was given the following VB CODE:

Sub test()

Dim Path As String

Path = "C:\Documents and Settings\Richard Sabbara\Desktop\"

With ActiveWorkbook
.SaveAs Filename:=Path & .Worksheets("Sheet1").Range("C1").Value &
".xls", _
FileFormat:=xlNormal, _
Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False

End Sub


Now the problem that I am having is more basic, when I try and run this
macro, I get the error message:

Compile Error: Expected End With

I am missing something basic here, what is it?

Thanks,

Richard