Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Apr 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Deleting Word Add-in from code in the Add-in (W2000/Office 2000)

    I have an add-in which is installed in the user's Word/Startup folder. The Add-in provides automatic backups of Word files to a nominated folder. It adds an item to the File Menu with options like: list backups, delete backups, change backup folder.

    I want users to be able to delete the Add-in using the File menu item.

    The code to remove the add-in works but only if run from another file. Code in an ad-in doesn't seem to be able to delete the add-in itself (ie. the macrocontainer). The macro terminates without an error - very ugly.

    I've tried passing control from the Add-in to another file (actually the add-in installer) but the Add-in stays locked and so the macro bombs. The code at that point looks like this:

    Sub deleteAddin()
    lblSelected = "Autobackup-Installer.doc"
    Documents.Open FileName:=lblSelected
    Application.Run macroName:="lblSelected!ThisDocument.UnInstall_Cli ck"
    End Sub


    The Application.Run seems to work OK but, you can see that until the called code finishes, the "deleteAddin" procedure isn't finished.

    I can't find a way of terminating the deleteAddin proc so that its container can be deleted.

    Can anyone help ?

    Many thanks

    GB
    <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Deleting Word Add-in from code in the Add-in (W2000/Office 2000)

    You could try to run the deinstall code from Application.Ontime
    This would enable you to exit the Sub in the original procedure before trying to delete it.

    StuartR

  3. #3
    Lounger
    Join Date
    Apr 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Deleting Word Add-in from code in the Add-in (W2000/Office 2000)

    Stuart, many thanks. It works a treat.

    I wish there was a way of deleting a file using code from within the file. But, this method of calling code in another file works so, I'll stick with it.

    Cheers

    GB
    <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

Posting Permissions

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