Given that I have a UserForm embedded in one of the following:
- an Excel workbook named
c:\myBook.xslm
- a Word document
c:\myDocument.docm
, or - a PowerPoint presentation named
c:\myPresentation.ppm
What Automation properties / methods do I need to use in order to open and display the UserForm from an external script / host application / program?
For example, let's say I have the following JScript running under WSH:
var app = new ActiveXObject('Excel.Application');
app.Visible = true;
var book = app.Workbooks.Open('c:\myBook.xlsm');
// open UserForm here
How would I proceed to open the UserForm?
Note: I am looking for a solution that would work with an arbitrary document. This precludes manually (but not programmatically as part of the script) adding a Sub
to show the UserForm
, which can be called from the external script.