Excel opens file as filename.xlsx

Tim_Excel_

Well-known Member
Joined
Jul 12, 2016
Messages
512
Hi Forum,

I just can't get my head around this.

Whenever I open the file I have been working on, it is opened as Macros. The code in this workbook refers to this name, which is essential. However, when my colleague opens the very same file I sent to him, it opens up as Macros.xlsm. Now this interferes with the code, as the code only looks for the name Macros and not Macros.xlsm. Does anyone know how this happens and how to work around it?

ask me any questions if you need to
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Maybe to make my problem easier:
Is there a way to have the code refer to either Macros or Macros.xlsm? I tried using "Macros*" but in this case there HAS to be at least one more charactar, so a name like Macros wouldn't work.
 
Upvote 0
The display of the file extension is controlled by a setting in Windows Explorer. Your code should refer to the workbook using Workbooks, not Windows, and include the file extension. That will always work.
 
Upvote 0
The display of the file extension is controlled by a setting in Windows Explorer. Your code should refer to the workbook using Workbooks, not Windows, and include the file extension. That will always work.

Thank you Rory. I was using Workbooks before not Windows. I'll try out adding the file extension as soon as I can!
 
Upvote 0
It may open looking like it is just called MACROS, but it will in fact still have a file extension of .xlsm whether you see it or not. All excel files (from 2007 onwards) that contain macros must have that extension .xlsm otherwise excel will strip out the macros.

Note that Rory said the DISPLAY of the file extension, not adding the extension or not :)
 
Upvote 0

Forum statistics

Threads
1,214,397
Messages
6,119,271
Members
448,882
Latest member
Lorie1693

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