Conflicts in coding between different workbooks

Nick Vittum

New Member
Joined
Apr 2, 2020
Messages
26
Office Version
  1. 365
Platform
  1. Windows
Background: (Maybe I'm supposed to say this somewhere else, but I can't find an introductions thread.) I'm new here. I've used this site for years, found many answers here, but this is my first time posting. The work I do with Excel (these days) is for my own use and I'm not brand new but still a relative novice to coding.

That said, my question at this point is a general one. I have a workbook for my own accounting purposes that I've put a lot of work into automating. But it's been an evolutionary process; no clear design in advance. What I'm running into now is that the coding which is basic to the way the workbook functions seems to conflict with other workbooks, if I have another open at the same time. For instance, a command button on a userform in the accounting WB will "bleed over" and cause things to happen in the other workbook. It's too complex and at this point too confusing to ask specific questions. (I might ask them when I understand better what's happening.) What I'm asking for now is if there are any guidelines, basic rules of thumb, whatever, I can find somewhere that will help me redesign/reword my coding so that it won't affect other workbooks?

Thanks!
 
To keep the modification within a specific workbook you have to play with its "Events" available within the vba module ThisWorkbook. Namely you should use these events:
-Workbook_Activate and Workbook_Open, to modify the ribbon
-Workbook_Deactivate and Workbook_BeforeClose, to restore it
Thank you! Curiously enough, I just discovered this same information on a very old thread here just moments before I read your comments. I haven't had time to try it out yet, but it looks like the missing piece.

Hope I didn't confuse you more that what I was wishing to do…
No, on the contrary, what you've given me here is extremely helpful. Many thanks.
 
Upvote 0

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,214,987
Messages
6,122,614
Members
449,091
Latest member
gaurav_7829

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