+ Reply to Thread
Results 1 to 6 of 6

Need Userform to install in different file

  1. #1
    Registered User
    Join Date
    11-16-2006
    Posts
    42

    Need Userform to install in different file

    I have a source spreadsheet open called “Asset” that has data on sheet 1 and vba subroutines in a module. There is also a userfile that’s open.
    Challenge #1: The program doesn’t know what the name of the userfile is in advance; it depends on what spreadsheet file the user opens up. How can my program "get" the name of the open userfile?
    Challenge #2: I need my userforms to open up on top of the userfile (to transfer data to the Asset program) when the userfile opens. It’s not practical to pre-install my userforms in every single userfile.
    Do I need to have my program install the userforms in the userfile when the userfile opens up? (and if so, how) Or is there another (simpler) way ?
    Last edited by marcmarc; 01-22-2007 at 01:08 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello MarcMarc,

    It's not clear to me from your post what type of userfile you are opening. Is it another Workbook, a Text file, or what? Also would need to see an example of how the user selects this file before I can help you with this problem.

    As for the second problem, I have a rather simple solution that maybe what you are looking for. You can force your Userform to remain on top of all other Windows. This feature is activated whenever your Userform is Activated.

    Add a Standard Module to your VBA Project and Copy/Paste the following code.

    Please Login or Register  to view this content.
    To keep the Userform on top, add a call to the Userform's Activate event.

    Example:
    Private Sub UserForm_Activate()
    Call KeepFormOnTop
    End Sub


    Sincerely,
    Leith Ross

  3. #3
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Try these methods to get workbook name

    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    or if workbook not already opened
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-16-2006
    Posts
    42

    re: Need Userform to install in different file

    Thank you, Leith for the info. The userfile is another workbook that the user has open on the desktop.

    If I could get the program to "know" the name of the other open workbook, then I can then tell the program to make it the active one.
    Thank you also, mudraker!
    Last edited by marcmarc; 01-22-2007 at 05:26 PM.

  5. #5
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    To activate other open workbook try this code

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    11-16-2006
    Posts
    42

    re:opening a workbook

    Just a note of thanks , mudraker.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1