Excel VBA: Finding workbook form belongs to
Posted on 2012-04-11
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.