Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling a UserForm in one file from another 1

Status
Not open for further replies.

Annelies

Programmer
Nov 25, 2001
72
Hi!

I have one file (lets call it MASTER.XLS) that opens another file (SUB.XLS)

Sub.xls has a userform in it (frmPeriodEnding) that prompts the user to press one of two buttons. frmPeriodEnding is called from code on Workbook_Open. It then runs one of two Private Subs (cmdChange_Click() or cmdDontChange_Click()).

Master.xls opens Sub.xls through VBA code.

What I want is for either:

a) to be able to hide or supress frmPeriodEnding from Master.xls
(ideally!)
or
b) to be able to execute cmdDontChange_Click from Master.xls

Unfortunately, changing the code in Sub.xls is not an option.

I tried using SendKeys but it did not work.

Any help would be gratefully received!

Thanks

Annelies :)
 
Hi,
seems that you need to lock Workbook_Open event, in all excel versions you can:
Application.EnableEvents=False
' open workbook
Application.EnableEvents=True

In excel xp+ you can programmatically set security levef for a programmatically opened file.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top