Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Mar 2002
    Location
    Copenhagen, Denmark
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Best practice to start Excel from VB6 (VB6 / Excel2000)

    Greetings!

    A user tries to start Excel from My documents, double-clicking an Excel document - and nothing happens, no Excel starts up, no error message, no nothing. If the same user starts Excel from within the Start button everything starts up fine and she can open an Excel document without any problem at all.

    So what's special about this girl? Well she uses an application, that I have developed quiet a lot - it's a VB6 application that uses Excel to edit and show order documents and I guess that she uses Excel from my application more than the other users. When this problem occurs she has to exit my application and then everything works OK again - she can start Excel documents from My documents without any problem at all.

    OK, so I have a problem with the way that I start Excel from my VB6 application. And here is my question then. What is best practice in starting Excel from within a VB6 application - I want to shell out, but I guess I don't control the Excel environment enough, hence something goes wrong after a while.

    I start Excel something like:

    ShowExcel:
    DoEvents
    On Error GoTo FailShowOrder
    ShellExecute Me.hwnd, "Open", FileOrder, "", App.Path, SW_SHOWNORMAL

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

    Re: Best practice to start Excel from VB6 (VB6 / Excel2000)

    I don't have a solution, but there is nothing wrong with the code you use to open an Excel workbook. I just tried it (substituting a path and file name of one of my workbooks) and I can then open another workbook from Windows Explorer without problem.

    For completeness' sake, let her check in Excel if "Ignore other applications" has been switched on in the General tab of Tools | Options... It should be off!

  3. #3
    New Lounger
    Join Date
    Mar 2002
    Location
    Copenhagen, Denmark
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Best practice to start Excel from VB6 (VB6 / Excel2000)

    Hi Hans

    I was wondering if there is something you should remember when revoking the shell command - to clean up afterwards somehow. I don't know of any way to do this, but it seems to me as if she fills up a buffer or something and this will prevent Excel to start with a document (the same way I start Excel from my VB6 application).

    Anyone have ideas?

Posting Permissions

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