Results 1 to 7 of 7
  1. #1
    New Lounger
    Join Date
    Jul 2003
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Word Add-In Help (XP)

    I'm trying to create an expiration function for an add-in I've created. The Add-in is called "AddFooter.dot" The problems I'm having are:

    1) The code doesn't seem to be running on open.
    2) If I manually run the code, how do I execute the delete(Kill) portion of the statment

    If someone has a better method I'm all for it.

    Thanks,
    Vetter

    This is the code that I call when opening the add-in

    Function AutoExec()
    Call TestForExpiry
    End Function

    This is the TestForExpiry Function


    Function TestForExpiry()
    Dim StartDate As Date, StartDate1 As Date
    On Error GoTo err_TestForExpiry:
    StartDate = #2/25/2004#
    'If CDate(Date) >= CDate(StartDate) Then
    StartDate1 = #3/1/2004#
    If CDate(Date) >= CDate(StartDate1) Then
    MsgBox ("You have now Exceeded your Grace Period for this Application(Add Footer for Word)!" & vbCrLf & "The Application will now terminate and will cease to function!" & vbCrLf & "Please Contact an Administrator!"), vbCritical, "Application Expired"
    With Documents("AddFooter")
    .Saved = True
    .Attributes = ReadOnly
    Kill .FullName
    .Close False
    End With
    Else
    If CDate(Date) >= CDate(StartDate) Then
    MsgBox ("This Application(Add Footer for Word) has Expired and will cease to function after Three (3) days." & vbCrLf & "Please Install an Updated Version!"), vbCritical, "Begin Grace Period"
    Exit Function
    End If
    End If
    Exit_TestForExpiry:
    Exit Function
    err_TestForExpiry:
    Resume Exit_TestForExpiry:
    End Function

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

    Re: Word Add-In Help (XP)

    AutoExec should be a macro, i.e. a procedure (sub) without arguments, so change it to

    Sub AutoExec()
    TestForExpiry
    End Sub

    However, the add-in will be open (in use) when you call the code, so you can't delete it. You can close it, but not delete it.

  3. #3
    New Lounger
    Join Date
    Jul 2003
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Add-In Help (XP)

    Hans-

    Thanks for the tips!
    However, The expiry code still does not run. I've changed that function to a sub as well but still doesn't run.
    Any suggestion on not allowing users to use the add-in then?

    Vetter

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

    Re: Word Add-In Help (XP)

    I don't have much experience with add-ins, so I hope others will chime in.

    Perhaps you should use the Document_Open event instead of AutoExec. Double-click ThisDocument in the Project Explorer, and write the following code:

    Private Sub Document_Open()
    TestForExpiry
    End Sub

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Add-In Help (XP)

    I gather the AutoExec macro is in the add-in. However, is the add-in template in the Word startup folder (under Tools/Options/File Locations/Startup)? The AutoExec macro only runs when Word starts.
    Regards,

  6. #6
    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: Word Add-In Help (XP)

    <P ID="edit" class=small>(Edited by jscher2000 on 07-Nov-03 12:31. Phil's note about how to confirm the startup path is more reliable than my default path, so it's a good idea to check there, too.)</P>Well, according to two sources, an AutoExec in a global add-in should run at startup (e.g., Dave Rado; MSKB 211659). However, it seems likely that this only applies to templates that are in the Application

  7. #7
    New Lounger
    Join Date
    Jul 2003
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Add-In Help (XP)

    It was in the folder. It runs other code underneath the startup options. Just must be something weird going on.

    Thanks for all the help and suggestions.

Posting Permissions

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