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

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Tim_Excel_

Well-known Member
Joined
Jul 12, 2016
Messages
512
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.
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,957
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
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.
 

Tim_Excel_

Well-known Member
Joined
Jul 12, 2016
Messages
512
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!
 

FDibbins

Well-known Member
Joined
Feb 16, 2013
Messages
6,723
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 :)
 

Watch MrExcel Video

Forum statistics

Threads
1,133,527
Messages
5,659,335
Members
418,497
Latest member
VAllen79

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
Top