Link to home
Start Free TrialLog in
Avatar of ouestque
ouestqueFlag for United States of America

asked on

Excel VBA: Finding workbook form belongs to

What VBA code would I need so that when a form in Excel opens, the workbook the form belongs to is stored in a public variable.

e.g., Whenever "ctrl+Y" is pressed the form opens. Therefore if the user is on another workbook and presses "ctrl-y" I would like the form to log the workbook the form belongs to, NOT THE CURRENT workbook.

e.g., putting "activeworkbook.name" in the "On Form Open" sub would not work in this case, as the form could be opened while the user is on another workbook in such case would yield incorrect results.
ASKER CERTIFIED SOLUTION
Avatar of StephenJR
StephenJR
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial