Results 1 to 6 of 6
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Automation with Microsoft Access (MS Office Xp)

    When I run similar code on my PC (Office XP SP3), the Excel userform gets the focus and I can enter data in it.

    It might help if you attached a zip file with stripped down copies of the database and workbook. See <post#=401925>post 401925</post#> for instructions.

    BTW: does the Test macro close the workbook and quit Excel? If not, your code will leave an invisible instance of Excel in memory.

  2. #2
    New Lounger
    Join Date
    Jun 2004
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automation with Microsoft Access (MS Office Xp)

    I'm using Access to open excel and run a macro. The macro runs a userform that requires data input.
    Excel is hidden with only the userform showing.
    I'm having no problem opening excel and running the macro, the problem is that if I click on the form in Access the userform from excel goes behind it.

    Dim objXL As Object, x
    On Error Resume Next
    Set objXL = CreateObject("Excel.Application")
    With objXL.Application
    .Visible = False
    .Workbooks.Open "c:Test.XLS" _
    , UpdateLinks:=0
    objXL.Application.Run "Test"
    End With
    Set objXL = Nothing

    I should have stated that the form from excel works. I'm allowed to enter data or I have a button to exit. My problem is if you click away from the Excel form on the form in access the excel form will go behind it.
    And yes the Test macro close's the workbook and quits Excel.

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

    Re: Automation with Microsoft Access (MS Office Xp)

    I would have been better to post the new information in a reply than to modify the original post. That is confusing for others who read this thread.

    If your Test macro opens the userform as a modal form (the default, it should retain the focus until it has been closed by the user. Do you happen to open the userform modeless?

  4. #4
    New Lounger
    Join Date
    Jun 2004
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automation with Microsoft Access (MS Office Xp)

    I've attached a zipped file. I have no problem using it like it is. When some users try to click and drag the excel form and then click the access form, thats when the excel form goes behind access.

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

    Re: Automation with Microsoft Access (MS Office Xp)

    I can't make the Excel userform go behind the Access window, and I am not able to drag it. If I click in the Access form while the Excel userform is open, the latter loses focus but is still on top. I did notice that sometimes the Excel userform doesn't get the focus if you click back in it after clicking in the Access form; in that situation I must press Alt+Tab once to make the userform active again.

  6. #6
    New Lounger
    Join Date
    Jun 2004
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automation with Microsoft Access (MS Office Xp)

    Thanks alot, I'll try that.

Posting Permissions

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