Results 1 to 9 of 9
  1. #1
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Run Word repair from code (Word 2000 - 2007)

    Due to business requirements I need to run Word repair via code instead of from the Help menu. Does anyone know the API or have code example to do this?

    Thank you

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

    Re: Run Word repair from code (Word 2000 - 2007)

    Do you mean that you want to run Help | Detect and Repair from code? That is not possible in VBA, since all Office applications have to be closed while this runs. I've never heard of an external API to call this feature.

  3. #3
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run Word repair from code (Word 2000 - 2007)

    I am thinking of running it using the Word object model via a VB6 application.

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

    Re: Run Word repair from code (Word 2000 - 2007)

    To use the Word object model, you need to create a Word.Application object, but that means an instance of Word is running. Detect and Repair requires that all Office applications are closed, so you can't have an active instance of Word. Moreover, there is no method in the object model that corresponds to Detect and Repair (it would be impossible)

  5. #5
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run Word repair from code (Word 2000 - 2007)

    I don't understand what you mean because when I go to the "Help" Menu and select detect and repair Word is open and the MSI installation dialog opens.

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

    Re: Run Word repair from code (Word 2000 - 2007)

    When I run Detect and Repair, the dialog starts while Word is still open, but at some point it asks to close Word (and any other open Office app).

  7. #7
    3 Star Lounger
    Join Date
    Nov 2002
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run Word repair from code (Word 2000 - 2007)

    Yes that is what happens with em as well. I may make a call to MS about this. It is simple enough to do from the help and I am too embarrassed to explain the business need to do it via code rather than the help menu path. Thanks Hans!!

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

    Re: Run Word repair from code (Word 2000 - 2007)

    Wait - you can run the Office setup from a command line with the /focums option. See for example Setup Command-line Options - Office 2003 and Description of setup command-line switches for Office 2003. You can run Setup from a VB6 app using Shell or ShellExecute.

  9. #9
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Run Word repair from code (Word 2000 - 2007)

    In versions 2000-2003, you usually can run a menu item by first finding the CommandBarControl and then using the Execute method. But not in Word 2007...

Posting Permissions

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