Unable to save edits to xlam with other file opened

jcarlosd

New Member
Joined
Oct 20, 2002
Messages
40
- If I open a .xlam file, I can modify it and save it without a problem (from VB Editor window and File-Save)
- But if I have a regular .xlsx opened too, and go to the VB Editor, the File-Save does not save my .xlam file. If I try (or simply clicking on the save icon) the screen flashes but nothing is saved

I am running Excel 2016 under Windows 10

I went to the forum and found this similar post: https://www.mrexcel.com/forum/excel-questions/485377-unable-save-edits-xlam-2.html
But my problem is lightly different
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
The save button in the VBE has always been unreliable in my experience. I suggest you add some code to the add-in to save itself, so that you can just run that as and when required.
 
Upvote 0
I suggest you add some code to the add-in to save itself, so that you can just run that as and when required.

It's an interesting idea. I tried to write a couple of code lines with that solution:
Code:
Sub SaveMyXlam()
Dim VBAProj As VBProject
Set VBAProj = ActiveWorkbook.VBProject
VBAProj.SaveAs VBAProj.Filename
End Sub

However this code returns an error 748. How can I save my current VB project?
 
Upvote 0
You don't save the project, you save the workbook:

Code:
Sub SaveMyXlam()
ThisWorkbook.Save
End Sub
 
Upvote 0
Thanks RoryA! I was trying with ActiveWorkbook.Save, but the correct one is ThisWorkbook.Save, as you pointed.

I still wonder why Excel 2016 can not perform a simple file save from the VBE, as it was working in versions 2010 and before...
 
Upvote 0
I have found it unreliable in every version I can remember, back to 2000 and possibly 97.
 
Upvote 0

Forum statistics

Threads
1,215,616
Messages
6,125,860
Members
449,266
Latest member
davinroach

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