VBA save and close not saving!

barcodezebra

New Member
Joined
Jun 11, 2018
Messages
3
Hi There


I've written a macro to paste some data into a template that I can use for creating a Configuration Package in Navision.


The final line of the macro should save and close the template but it doesn't. It closes without saving. As far as I can see it's a bog standard line of VBA that everyone uses so I'm not sure why it's not working for me.


Can anyone help? The code is

Workbooks("GL Transaction Import Template.xlsx").Close SaveChanges:=[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]True

Cheers
[/FONT]


<style></style>
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Welcome to the forum.

Does it make any difference if you use two explicit calls:

Code:
With Workbooks("GL Transaction Import Template.xlsx")
   .Save
   .Close
End With

If not, can you post the rest of the code too, please?
 
Upvote 0
Depending on your environment, my bet is that the workbook is saved but in another folder. With a good search tool, search for your file all over the place.
 
Upvote 0
Depending on your environment, my bet is that the workbook is saved but in another folder. With a good search tool, search for your file all over the place.


Oh God! The burning shame! You're absolutely right. And not only are you right but the path to the document is specified earlier in the code when I ask VBA to go off and open it for me.

What a clown. :oops:

Thanks for your help!
<style></style>
 
Upvote 0
Thanks Rory


That works but, to my eternal shame, so did my original code. I was just looking for the workbook in the wrong place.


I feel properly foolish!<style></style>
 
Upvote 0
:biggrin:

Well, at least the problem is resolved! ;)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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