Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Another MSKB sample problem (XP)

    I downloaded the Office XP Help file for Automation, and I'm working with the section on "Sending the Current Record to Microsoft Word." I'm manually keying in the sample code, and I hit a Compile Error with this little snippet:

    <font face="Georgia"> SaveChanges<span style="background-color: #FFFF00; color: #000000; font-weight: bold">:=</span hi>wdDoNotSaveChanges <font color=blue>[Note highlight]</font color=blue>
    ' Quit Microsoft Word and release the object variable.
    objWord.Quit
    Set objWord = Nothing
    Exit Sub</font face=georgia>

    The error message says, "Expected: Expression". From the error message I can't see that I might trace the error to something earlier in the code. See anything obvious?

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

    Re: Another MSKB sample problem (XP)

    The line SaveChanges:=True is not a complete instruction, either something was omitted, or there is a line before it that should end in an underscore _ to indicate that the instruction is continued on the next line. SaveChanges is an argument to the Close method of a Word document: Since I don't know the rest of the code, here isare two imaginary examples:
    <pre>objDoc.Close SaveChanges:=wdDoNotSaveChanges
    </pre>

    or
    <pre>objWord.ActiveDocument.Close _
    SaveChanges:=wdDoNotSaveChanges
    </pre>

    Note the space + underscore after the first line in the second example.

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: Another MSKB sample problem (XP)

    Thanks again, Hans

Posting Permissions

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