Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Feb 2003
    Location
    Renfrewshire, Scotland
    Posts
    35
    Thanks
    2
    Thanked 1 Time in 1 Post

    userform control (word/excel 2000)

    Anyone know how to open/initialize/show an Excel userform from a Word userform?. I can start the Word userform, open, use and manipulate excel data but can't find how to start a userform created in excel from a command button on the Word form. The Excel userform is used only to manipulate the workbook data (if that makes any difference) <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: userform control (word/excel 2000)

    If you don't have one yet, create a macro in the Excel workbook that opens the userform, let's say StartForm:

    Sub StartForm()
    frmManipulate.Show
    End Sub

    You can call this macro from Word like this

    Dim objXL As Excel.Application
    Dim objWB As Excel.Workbook
    Set objXL = CreateObject("Excel.Application")
    Set objWB = objXL.Workbooks.Open("Book1.xls")
    objXL.Visible = True
    objXL.Run "StartForm"
    ...

  3. #3
    Lounger
    Join Date
    Feb 2003
    Location
    Renfrewshire, Scotland
    Posts
    35
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: userform control (word/excel 2000)

    Thanks HansV,
    I had all the stuff in the 2nd part - I think my problem was that my code to start the form was in the Forms module. Since your solution didn't say where to put it I thought I'd try putting it in the Modules section - Eureka! <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Would I be right in thinking then that any code in the forms module can't be seen until the form fires up? unless started with the forms module open?
    I can foresee some other problems in the same project with list boxes but I'm off on to the sun for 2-weeks so it'll keep. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    Regards,
    DougieW <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: userform control (word/excel 2000)

    You're correct - you can't use code in the userform module to start the userform...

Posting Permissions

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