View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Auric__ Auric__ is offline
external usenet poster
 
Posts: 538
Default File Path Issue in Excel 2016 for Mac

colglbo wrote:

I have been using visual basic in Excel 2011 for Mac to open a file
and perform some operations on that file. The code to open the file is

Workbooks.Open Filename:= "Mac Backup:Data Files:Excel Files:Test
File.xlsx"

Mac Backup is the name of a removable drive.

The code has worked fine until I upgraded to Excel 2016 for Mac. Now
when I run the code I get the message "Sorry, we couldn't find Mac
Backup:Data Files:Excel Files:Test File.xlsx."

I have changed the colon to back slash and forward slash and still get
the error message. This same code works fine in Excel 2016 for PC
using the back slash. Apparently something has changed in the file
path structure in the Excel 2016 version for Mac. Any help would be
appreciated.


Create a new macro-enabled (.xlsm) workbook in the same directory. Put this
code in a new module:

Sub whereAmI()
Cells(1, 1).Value = ActiveWorkbook.Path
End Sub

A1 now contains the path of the workbook. Update your existing code.

--
Are there people in your house right now you'd just love to strangle,
but can't because it's not polite to do that to company?