• AutoExec Conditional (Word VBA)

    Author
    Topic
    #446545

    Greetings.

    I have a startup Add-in.

    It has an AutoExec function to display a form if a particular setting is true in the registry.

    I would like to make this conditional on how Word was loaded. If loaded by double clicking a document in Explorer or a document in the Start Documents list (that is, if Word is loaded WITH a document) I want to abort the AutoExec. If Word is opened normally, I want to check whether or not to display the form.

    Any way to grab the command line from VBA?

    What’s happening now (in Word 2003) is that loading with a Document does NOT load the document but runs AutoExec and stops.

    Viewing 0 reply threads
    Author
    Replies
    • #1086111

      The command line doesn’t seem to be exposed in the Word object model. You may be able to use code like this:

      If Documents.Count = 1 Then
      If InStr(ActiveDocument.FullName, “”) = 0 Then
      ‘ Only blank new document open, so Word wasn’t started by double clicking a doc
      End If
      End If

    Viewing 0 reply threads
    Reply To: AutoExec Conditional (Word VBA)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: