View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Mike Fogleman Mike Fogleman is offline
external usenet poster
 
Posts: 1,092
Default get the current filename as a variable

Try this: I added a : after Documents in your Const. I am not familiar with
MAC file naming, but I thought there should be a separator for the
folder/file. In any case, myFileName should get the desired results there.
You just need to make sure that fName puts the path and file name together
correctly for MAC.

Sub SaveMe()
Dim fName As String
Dim myFileName As String
Const fPath As String = "Mac OS X:Users:jrough:Documents:"

myFileName = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4) & " " &
Date & ".xls"
fName = fPath & myFileName
ActiveWorkbook.SaveAs Filename:=fName

End Sub

Mike F
"Janis" wrote in message
...
The myFileName line does not compile. What I want to do here is save the
current filename with the date appended. I am trying to put the current
filename into the Sub
tnx,
saveIndesign()
'Appends date to filename so as to not write over an existing file

Const fPath As String = "Mac OS X:Users:jrough:Documents"
Dim fName As String
Dim myFileName As String
myFileName = ActiveWorkbook.Filename
fName = fPath & myFileName & Time()
ActiveWorkbook.SaveAs Filename:=fName
End Sub