macro to save a file

J

Janis

I recorded this macro. It works but I want the filename to be a variable not
hard coded in the macro so it saves the current file name. Is there anyway
to keep it from writing over the last one if the names are the same? Say it
saved two of the same name in the same day. Perhaps by adding the datestamp
to the variable for the name?

thanks,


Option Explicit
Sub saveforIndesign()
'
' saveIndesign Macro
ChDir "Mac OS X:Users:jrough:Documents:"

ActiveWorkbook.SaveAs Filename:= _
"Mac OS X:Users:jrough:Documents:ssp_latest_082406.xls",
FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub
 
D

Die_Another_Day

Try this:
Const fPath as string = "WeirdMacintoshPathInfo"
Dim fName as string
fName = fPath & Variable & Time()

ActiveWorkbook.SaveAs FileName:=fName

HTH

Charles
 
M

Mike

If the windows scripting host object model is available on the Mac, you can
use the filesystemobject's .fileexists property to check if the filename is
already taken.
 

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

Similar Threads


Top