Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jun 2004
    Location
    Oxford, Oxfordshire, United Kingdom
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    converting an old macro (2003)

    I am trying to reactivate some old macros developed for mail merge in Word XP on a new system with 2003 and Vista. A key line that used to work is now marked as having a syntax error.

    Here it is:
    Documents.Open FileName:="""c:/users/endean/documents/templates/Personal DL Envelope.doc""",
    ConfirmConversions:=False, ReadOnlC:UsersendeanInformation=False, AddToRecentFiles:=False, _
    PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
    WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
    wdOpenFormatAuto

    Can anyone see why it's getting flagged up in this way?

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: converting an old macro (2003)

    I don't know if this is just an error in posting here, but this bit looks odd:
    ReadOnlC:UsersendeanInformation=False,

    Should this be Readonly=False ?
    Regards
    John



  3. #3
    3 Star Lounger
    Join Date
    Jun 2004
    Location
    Oxford, Oxfordshire, United Kingdom
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: converting an old macro (2003)

    Thanks--that was certainly part of the problem (I had run a find/replace through the old VBasic macros when I shifted system).

    But there's still a problem with that first line. A part of it may be that when I open the file in question, which is a merge file, it is looking for the database it used to be connected to. I get to a dialogue box called 'Data link properties', which gives a file location for the database where it used to be--I've solved that for the moment by redoing the merge from scratch.

    It's also the case that Word 2003 seems to want ChangeFileOpenDirectory "C:UsersendeanDocumentsTemplates", and then Documents.Open FileName:="""personal envelope.doc"""; it throws a snit if you cut the first line and put the directory into the file name.

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

    Re: converting an old macro (2003)

    You should be able to use

    Documents.Open FileName:="c:usersendeandocumentstemplatesPersonal DL Envelope.doc", _
    AddToRecentFiles:=False

    Note the use of " instead of "", and the use of instead of / compared to your original code. It shouldn't be necessary to invoke ChangeFileOpenDirectory.

  5. #5
    3 Star Lounger
    Join Date
    Jun 2004
    Location
    Oxford, Oxfordshire, United Kingdom
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: converting an old macro (2003)

    many thanks

Posting Permissions

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