Almost there

E

eyeman6513_2000

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
 
B

Bob Phillips

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)
 
N

NickHK

Yes, not reading the error message.
It tells you are missing an "End With" before the "End Sub".

NickHK
 
E

eyeman6513_2000

It works wondefully, thank you all so much, you have saved me HOURS of
work.

If you anyone can recommed a good VB book, I am open to suggestions, I
am at a new job, I currently work with SQL a lot, however this I am
seeing the need to do more and more with VB and Excel, while these
boards are a great source of knowledge, I would like to increase my own
known personal knowledge base.

Thank you all again.

Richard
 
G

Guest

Your response seems a bit harsh. Remember not all participants have the same
knowledge as you or I. We're here to be helpful.
 
G

Guest

Eyeman - I'd recommend pretty much anything by John Walkenbach, especially
the "Bible" series (there's versions for each release of excel). They've been
an immense help to me as I've been learning how to use excel and VBA. You can
get them through most decent bookshops.

HTH
DS
 
B

Bob Phillips

Dunno, made me smile, and the OP didn't seem to take offence.

--
HTH

Bob Phillips

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

NickHK

It wasn't meant to be too mean, but the OP did ask "I am missing something
basic here, what is it?".
The answer, I felt, was Yes.

NickHK
 
E

eyeman6513_2000

For the record, I didn't take offense, I got the answer that I needed,
I have saved HOURS of work as a result, thank you all for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top