Workbook_open is not saving my workbook

L

Legacy 243189

Guest
Hello,
I came into an issue while setting up macro on a workbook i have.

the issue is i need the following sets of actions to be completed when the workbook got opened programmitcally :

save workbook
and save as pdf.

below the macro i have

Private Sub Workbook_Open()
ActiveWorkbook.Save
Basma

End Sub
Sub Basma()

ThisWorkbook.Save


ChDir "C:\NOC_Automation\Parser Reports\Count Reports"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\NOC_Automation\Parser Reports\Count Reports\NOC Weekly Trend Reports.pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False


End Sub

the thing is .. when i opened the workbook and close it i got the message do you want to save changes..
this message doesn't suppose to appear cause i already saved the workbook.

Please advise where i got this macro wrong.

thanks,
Basma
 
Hello drgs,

Thank you for your help.
The macro is working fine. the issue was with the software which was running the batch file. I have made a schedule task to run the batch and it is working fine.

Thank you again.
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,223,270
Messages
6,171,102
Members
452,379
Latest member
IainTru

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