Copying sheet from 1 workbook to another, disabling macros in the process

wwbwb

Well-known Member
Joined
Oct 20, 2003
Messages
513
Greetings all,

I am working on some production reporting workbooks. The users open their PRs and fill in their information. At the end of the day, a tech will open a Master PR which will import all the data for consolidation. Everything is working great.

The PR workbooks have code that runs at open. Basically security stuff to keep them from using toolbars and menus and such. When I use the Master PR to import the data, just copying a range from the PR to the Master PR, all the code runs for each PR that is opened. Here is my question.

Is it possible to prevent the PRs open code from running each time I open it from another workbook?

or will I have to add something to the PR code like: if master PR.xls is open exit sub
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
I was waiting to see if one of the MVPs would reply but since they haven't I'll take a stab and cause the thread to bump.

Does the Master PR book have to be in the same place as the User PR books?

Could you do something with the "Trusted Path" to make the User PR books live in a place that is not a trusted path to the macro copying to the master and this way the open macro wouldn't run?

I looked a bit but did not find a way to set an option on the Workbooks.open or on the application to block running the open macro.
 
Upvote 0
They don't have to be in the same place, but ideally they should be to keep things simple.

I'm working on my second option of adding code to the beginning of the PR workbook_open code.

So far it seems to be ok. Basically it checks to see if the master pr workbook is open and if it is, it bypasses the security activating code lines and exits the open sub, otherwise if the master pr is not open, it proceeds with the security code.
 
Upvote 0
That seems the most sensible solution. I wondered if the problem was that there were multiple "User PR" files in the wild that you would have to track down and update because people had made their own copies.

Is there a reason that you don't have the "User PR" write just the data/sheet to a separate workbook when the user saves it? Then there would be no macro in the file.
 
Upvote 0
The User PR contains a couple sheets. One where the user inputs their data. The second sheet is a history of their daily work. This way they can go back and see what they did on any given day. Also, this history sheet ties in with one of the managers spreadsheets that pulls monthly totals, by week, for evals.

All the User PRs are kept in one folder and if they try to use their PR outside of their folder, it won't work properly. I create the User PRs from a Template PR where I can make changes and within it, I have an update macro that applies any changes I make to it, to the User PRs. Cause I found out updating 12+ PRs with new code or updates was way too tedious. Smarter not harder, right? :)
 
Upvote 0

Forum statistics

Threads
1,214,798
Messages
6,121,635
Members
449,043
Latest member
farhansadik

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