Macro - File Save As

T

tucopup

I'm using the macro below to save a file after clicking a button to
certain cell value. I've moved the start file to a different folder
but the saved version go back to the old one. I can't figure out wh
that is based on the info in the macro.


Sub SaveAs()

Dim a_str1 As String
Dim sname As String

a_str1 = ActiveSheet.Cells(5, 2).Value

sname = Trim(a_str1) + Trim(b_str1) + ".xls"

ActiveWorkbook.SaveAs Filename:=sname, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=Fals
 
D

Dave Peterson

I'm not sure what's in a_str1, b_str1, but if you specify the folder you want to
save the workbook to, it might be easier and safer.

ActiveWorkbook.SaveAs Filename:=thisworkbook.path & "\" & sname, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

If I understood correctly.
 

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