PDA

View Full Version : [SOLVED] Open UserForm from an Add-In



mdmackillop
05-18-2005, 03:09 AM
I've created an add-in, "Printing.xla" which contains a Userform "PrintSelector" and other code modules, which were previously all saved within Personal.xls. The add-in has been added to Personal.xls and is visible in the VBE when a new workbook is opened. What change do I have to make to the PrintSelector.Show line in my sub to open the Userform in its new location?

Bob Phillips
05-18-2005, 03:35 AM
I've created an add-in, "Printing.xla" which contains a Userform "PrintSelector" and other code modules, which were previously all saved within Personal.xls. The add-in has been added to Personal.xls and is visible in the VBE when a new workbook is opened. What change do I have to make to the PrintSelector.Show line in my sub to open the Userform in its new location?
What do you mean by '...The add-in has been added to Personal.xls ...'? I ask, because add-ins are stand-alone, and you install in Excel. Do you mean you want to show a form in the add-in from Personal.xls. If so, then try this approach

Create a macro in the add-in that simply shows the form

Run that macro from Personal.xls


Application.Run "Printing.xla!ShowForm"

mdmackillop
05-18-2005, 03:55 AM
I'm showing my lack of knowlede of XLA's here, but thanks for method. That's exactly what I was after.

Bob Phillips
05-18-2005, 04:11 AM
I also forgot to mention (forgot because I always tend to give late-binding answers, it's easier :)), but if you set a reference to the add-in in the VBE, you can call that macro directly, without Application.Run. i.e.

ShowForm

Just make sure you don't use the name elsehwere. We ran into some nasty problems receently with an add-in that had a help file, and not surprisingly, we called the launch macro ShowHelp, but unfortunately, so do most other add-in writers who have Help.

mdmackillop
05-18-2005, 05:40 AM
Thanks,
Thats useful to know, but as I'll be issuing this to a number of less than knowleable users, installing an add-in and a macro into Personal.xls is ambitious enough!