Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    New York
    Thanked 0 Times in 0 Posts

    AutoExec Conditional (Word VBA)


    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.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: AutoExec Conditional (Word VBA)

    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

Posting Permissions

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