Find/Replace a statement in XL VBA code

Sreez

New Member
Joined
Jul 6, 2009
Messages
2
Hi All,

I have set of around 25 Excel sheets (Version 2003), each with multiple VBA modules. These Excel sheets use a hard coded path to an Access database to connect to a database and do some SQL transactions.

I was wondering if there is a way to search these hard coded statements across these multiple excel sheets and replace them with another statement.

I tried the Windows search (through windows explorer and desktop search) to find workbooks containing the hard coded statement in the VBA code . But this does not return any results.

Any ideas.

Thanks
Sree
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
I don't know of a way to search through workbooks and make changes in the VBA modules of those sheets, but I do have a suggestion to permanently simplify/solve this problem.

Store the "hardcoded" path in another workbook in a specific cell as a text string, then have all your other sheets draw in that value, either by VBA or by having a cell in each sheet that does that job via external link. Then the VBA in each sheet can refer to the text string it looked up rather than hard-coding, so if you change it in that single external location, all workbooks using it are automatically updated, too.
 
Upvote 0
:) thanks JB, that is precisely what I was planning to do but was wondering if there is a simpler way of making those changes in all those VBA modules.
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,699
Members
449,048
Latest member
81jamesacct

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