Serious Sam
New Member
- Joined
- Jan 19, 2005
- Messages
- 30
Hi Folks,
I've got some code attached to a button in a workbook.
When clicked, another workbook that is housed in the same folder is opened.
This workbook is then Saved As another file name in the same folder.
It has worked for years with PC users (Excel 2003), but lately a Mac user has a need to use it and one part of the code doesn't work (Excel for Mac 2004).
To get the current filepath the command ThisWorkbook.Path is used
This is what the Mac is not recognising.
Is there another command that can be used instead?
I've searched extensively and haven't been able to find one.
The key sections of the code is below:
Dim sFilePath As String
Dim sFileName As String
sFilePath = ThisWorkbook.Path ' ThisWorkbook.Path is not being recognised
sFileName = "\Mastercopy.xls"
Workbooks.Open Filename:=sFilePath & sFileName
SaveFileAs "/Run Sheet " & Format(sToday, "Mmmm dd yyyy"), sFilePath
Regards,
Sam
I've got some code attached to a button in a workbook.
When clicked, another workbook that is housed in the same folder is opened.
This workbook is then Saved As another file name in the same folder.
It has worked for years with PC users (Excel 2003), but lately a Mac user has a need to use it and one part of the code doesn't work (Excel for Mac 2004).
To get the current filepath the command ThisWorkbook.Path is used
This is what the Mac is not recognising.
Is there another command that can be used instead?
I've searched extensively and haven't been able to find one.
The key sections of the code is below:
Dim sFilePath As String
Dim sFileName As String
sFilePath = ThisWorkbook.Path ' ThisWorkbook.Path is not being recognised
sFileName = "\Mastercopy.xls"
Workbooks.Open Filename:=sFilePath & sFileName
SaveFileAs "/Run Sheet " & Format(sToday, "Mmmm dd yyyy"), sFilePath
Regards,
Sam