Consulting

Results 1 to 5 of 5

Thread: Open UserForm from an Add-In

  1. #1
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location

    Open UserForm from an Add-In

    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?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by mdmackillop
    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"

  3. #3
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    I'm showing my lack of knowlede of XLA's here, but thanks for method. That's exactly what I was after.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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.

  5. #5
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    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!
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •