Page 6 of 6 FirstFirst ... 456
Results 76 to 88 of 88
  1. #76
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,948
    Thanks
    0
    Thanked 204 Times in 185 Posts
    Hi George,

    For that, you could try the same fix as in post #71, perhaps with the new line preceded by 'On Error Resume Next' (so that errors won't prevent other files being updated).
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  2. #77
    3 Star Lounger
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    243
    Thanks
    20
    Thanked 0 Times in 0 Posts
    Hi Paul

    I have looked at the date-fix code and I am unable to find the relevant area, as per Post #71, you suggest that I replace.

    Also, at the moment, each time either of the two macros strike an error, the only option I seem to have is to start running them all over again from the beginning. Ideally, it would be great if the macros did not to stop on an error, but continue to the end.

    If this can't be done, is there a way of continuing from a specific point onwards that I choose manually? Although not ideal, because I would have to do this manually, I could at least set the starting point after the file with the error instead of always having to run the macros from the beginning.

    Regards
    George

  3. #78
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,948
    Thanks
    0
    Thanked 204 Times in 185 Posts
    Hi George,

    The 'UpdateTemplateRefs' sub in post #74 should be fairly immune to any further crashes, as errors are directed to the error-processing part of the sub.

    As for the date-fixing version of the sub, try inserting:
    On Error Resume Next
    anywhere before:
    objFile.ModifyDate = StrTmp
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  4. #79
    3 Star Lounger
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    243
    Thanks
    20
    Thanked 0 Times in 0 Posts
    Hi Paul

    I will put that 'On Error Resume Next' line in the date-fix code and let you know how it goes.

    Regarding the change-template-path macro, I made the code change as per Post #74, but unfortunately it still 'crashed' after running for a while, with:

    Run-time error '91'
    Object variable or Withblock variable not set

    Debug highlighted:

    .Close SaveChanges:=True

    Regards
    George

  5. #80
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,948
    Thanks
    0
    Thanked 204 Times in 185 Posts
    Hi George,

    I really am perplexed by the range of errors you seem to be getting.

    Try changing:
    .Close SaveChanges:=True
    to:
    Code:
      On Error GoTo NotSaved
      .Close SaveChanges:=True
    NotSaved:
      If .Saved = False Then
        ' Output a 'protected' file report in the document from which the macro is run.
        ThisDocument.Range.InsertAfter vbCr & strDoc & " save error. Not updated."
      End If
      On Error GoTo 0
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  6. #81
    3 Star Lounger
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    243
    Thanks
    20
    Thanked 0 Times in 0 Posts
    Hi Paul

    I am really embarrassed to have to keep coming back to you with new issues.

    I have substituted the new code you kindly sent in the macro and ran it again on the same folder and this time it 'crashed' immediately with:

    Run-time error '5825'
    Object has been deleted

    Debug highlighted:

    If .Saved = False Then

    Regards
    George

  7. #82
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,948
    Thanks
    0
    Thanked 204 Times in 185 Posts
    My apologies. Change:
    .Close SaveChanges:=True
    to:
    .Save
    and insert:
    .Close SaveChanges:=False
    after:
    On Error GoTo 0
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  8. #83
    3 Star Lounger
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    243
    Thanks
    20
    Thanked 0 Times in 0 Posts
    Hi Paul

    You must be sick of me ...

    I made the changes, but would you believe, the macro 'crashed' immediately with:

    Run-time error '450'
    Wrong number of arguments or invalid property assignment

    Debug highlighted:

    oItem.DateLastModified = StrDtTm

    As in Post #70 but I made the change that you requested then.

    Regards
    George

  9. #84
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,948
    Thanks
    0
    Thanked 204 Times in 185 Posts
    Hi George,

    Try inserting:
    On Error Resume Next
    before that line, and:
    On Error GoTo 0
    after it.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  10. #85
    3 Star Lounger
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    243
    Thanks
    20
    Thanked 0 Times in 0 Posts
    Hi Paul

    I put the code in as you requested and the macro ran for a short while on that same folder, then it 'crashed' with the same error (Post #83).

    Regards
    George

  11. #86
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,948
    Thanks
    0
    Thanked 204 Times in 185 Posts
    OK, try replacing everything between:
    Set oItem = FSO.GetFile(strDoc)
    and:
    Set oItem = Nothing
    with:
    Code:
    If IsDate(StrDtTm) Then
      If oItem.DateLastModified <> StrDtTm Then oItem.DateLastModified = StrDtTm
    End If
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  12. The Following User Says Thank You to macropod For This Useful Post:

    useful (2012-12-03)

  13. #87
    3 Star Lounger
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    243
    Thanks
    20
    Thanked 0 Times in 0 Posts
    Hi Paul

    In the meantime I ran the date-fix macro and it ran fine AND finished without error. I did some spot checks and it replaced the Modified dates with Content Created dates, just as we wanted.

    Thank you very much!

    I will make the suggested code changes to the change-template-path macro and report back.

    Regards
    George

  14. #88
    3 Star Lounger
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    243
    Thanks
    20
    Thanked 0 Times in 0 Posts
    Hi Paul

    I made the change to the template-path macro as you suggested and ran it on the same folder as before. It immediately 'crashed' with the error:

    Run-time error '91'
    Object variable or Withblock variable not set

    Debug highlighted:

    If oItem.DateLastModified <> StrDtTm Then

    I'm clearly having no luck with this one!

    Regards
    George

Page 6 of 6 FirstFirst ... 456

Posting Permissions

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