Current FilePath for Mac users

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
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,224,537
Messages
6,179,408
Members
452,912
Latest member
alicemil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top