Change Part Of Before Save Code In Bulk?

Dazzawm

Well-known Member
Joined
Jan 24, 2011
Messages
3,783
Office Version
  1. 365
Platform
  1. Windows
I have loads of files that have a before save code within them. I need to change the location, is it possible to change part of the code without opening them all individually?

This is the code

Rich (BB code):
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)


    If MsgBox("Save?", vbYesNo, "Confirm") = vbNo Then Exit Sub
   Application.DisplayAlerts = False
    ActiveSheet.Copy
   ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\MANAGER\Desktop\Darrens Catalogues\Suspension_Catalog2.1A.csv", FileFormat:=xlCSV, CreateBackup:=False
    ActiveWorkbook.Close False
End Sub

All I need to change is the 'Manager' in red to Manager1!

From another code I have it uses [FONT=Helvetica, Arial, Verdana, sans-serif]ADO connection and SQL that doesn't open the files is it possible here?[/FONT]
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Have you considered using the VBExtensibility library ?

Edit:
But that would open the files. However you could temporarly disable the application events, open the files, make the changes , save and close ... I think you could even have the excel files opened in another hidden instance of excel .
 
Last edited:
Upvote 0
Have you considered using the VBExtensibility library ?

Edit:
But that would open the files. However you could temporarly disable the application events, open the files, make the changes , save and close ... I think you could even have the excel files opened in another hidden instance of excel .

Thanks for the reply but I don't understand it!!

It doesn't matter if the code opens, makes the changes and closes them again.
 
Last edited:
Upvote 0
Cross-posted: https://www.ozgrid.com/forum/forum/...19685-change-part-of-before-save-code-in-bulk

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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