Results 1 to 4 of 4

Thread: How to call a user form from a different workbook

  1. #1

    How to call a user form from a different workbook



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Basically I would like the user to be able to call the user Menu form that exist in a different workbook from the command-button that exist on the worksheet that is open.

    What happens is the user open a User menu form, from that form they then access a file that exist in a different workbook. When that file open the form closes. When they want to go back to the user-menu form they should be able to click on a command button that is on the worksheet that will then reopen the user-menu and close the current workbook that they are in.

    example

    the menu form is called formUserDataSheet, which is accessed from a parent user Menu form called frmUserFormExample in the workbook called userformExample.
    The worksheet that is opened from the formuserDataSheet is called FSO Open Report.
    the command button on the worksheet right now is just called command button


    I am so close but not quite there. Currently If I open up the FSO Open Report directly and then click on the command-button on the worksheet, It will take me to the User-Menu form That exist in userFormExample.xlsx. However if I access the FSO Oen Report worksheet through the user-Menu form , and then click on the command button to get back to the user-form it does not work, because the worksheet will open in the workbook(userformExample) that the user Menu form exist in. So I'm thinking I have to some how actually put the command button event code in the same work book as the form..

    Here is the code I currently have running in the command-button event in the FSO Open Report.

    Code:
    Private Sub MySub() 
      Application.Run "UserformExample.xlsm!ShowDataSheetForm"
    End Sub
    and to access the form in the userformExample workbook I have the following code in a VBA module in the userFormExample workbook.

    Code:
    Public Sub ShowDataSheetForm()
    frmUsrDataSheet.Show
    End Sub


    Apparently since the worksheet will open in the userformExample workbook. I need to put the command-button event code inside the userformExample workbook.


    Any suggestions?


    The path to access the FSO Open Report is
    strFileName = "C:\Users\ddempsey\Desktop\projects\dashboard project\MSO dashboard\New folder\" & "\" & myfolder & "\" & myfile & ".xlsx" & ".xlsm"

    where myfolder = month selected by user (in this case December) and myfile = file selected by user, (in this case FSO Open Report)
    Attached Files Attached Files
    Last edited by dariusd7; 2014-02-10 at 03:30 PM.

  2. #2
    Super Moderator JoePublic's Avatar
    Join Date
    Sep 2011
    Location
    Askew
    Posts
    170
    Articles
    0
    Cross-posted here: http://www.excelforum.com/excel-prog...-workbook.html
    Please read the forum rules about cross-posting.
    Circumference of a circle = 2πrē



    ēthe circle's radius

  3. #3
    Quote Originally Posted by JoePublic View Post
    Cross-posted here:
    Please read the forum rules about cross-posting.
    I looked under FAQ and also searched Cross Posting, but I could not find anything about cross posting. so can you please tell me what it is.

    Thanks

    O)k wait.. Is this forum connected to Excelforum.com? is that what you mean

  4. #4
    Super Moderator JoePublic's Avatar
    Join Date
    Sep 2011
    Location
    Askew
    Posts
    170
    Articles
    0
    No, it isn't connected. Please read this: http://www.excelguru.ca/forums/faq.p...osting_details
    Circumference of a circle = 2πrē



    ēthe circle's radius

Tags for this Thread

Posting Permissions

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