Results 1 to 5 of 5
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Document_Close macro problem (Word 2000 SR-3)

    This is just in reaction to your PS.

    The Lounge software ignores indents. There are two ways of getting indents
    The <!t>[tab]<!/t> "tag" is converted to 4 spaces.
    Everything between the <!t>[pre]<!/t> and <!t>[/pre]<!/t> tags is displayed in a monospaced font just the way you typed it.

    Both types of tags can be inserted manually, or by using the 1-Click TagPanel that is visible above the editing space when you are creating or modifying a post.

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Document_Close macro problem (Word 2000 SR-3)

    That's interesting.

    A simple test shows that ff you open a document and use the VBE Immediate window to examine ActiveDocument.BuiltInDocumentProperties(wdPropert yTimeLastSaved) then it sets ActiveDocument.Saved=False.

    You could work round this by defining a boolean variable to remember the previous state...

    blWasSaved = ActiveDocument.Saved
    Newtm = ActiveDocument.BuiltInDocumentProperties(wdPropert yTimeLastSaved)
    ActiveDocument.Saved = blWasSaved

    StuartR

  3. #3
    2 Star Lounger
    Join Date
    Dec 2002
    Location
    San Francisco, California, USA
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Document_Close macro problem (Word 2000 SR-3)

    That solved it. Thanks! Sure is strange that Word works that way. And I never would have thought to set a boolean variable as a solution, so I really appreciate it.

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Document_Close macro problem (Word 2000 SR-3)

    It looks like simply accessing the FileProperties dialog (even just to look) dirties the activedocument.

    Maybe reading ANY document property will do the same.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  5. #5
    2 Star Lounger
    Join Date
    Dec 2002
    Location
    San Francisco, California, USA
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Document_Close macro problem (Word 2000 SR-3)

    <P ID="edit" class=small>(Edited by gwhitfield on 25-Apr-03 09:43. Inserted [pre] tags)</P>I'm trying to create a macro that sends the doc via email if it's been changed since I opened it. The code looks like this; description of the problem follows:

    <pre>Private PrevSavedTime As Date
    ______________________________
    Private Sub Document_Close()
    Newtm = ActiveDocument.BuiltInDocumentProperties(wdPropert yTimeLastSaved)

    ' If the document has been changed, but not saved, this routine should triggger:

    If ActiveDocument.Saved = False Then
    ActiveDocument.SendMail

    ' If document has been changed AND saved, the previous routine should not trigger,
    ' but this one should trigger:

    ElseIf Newtm <> PrevSavedTime Then
    ActiveDocument.SendMail
    End If
    End Sub
    _______________________________
    Private Sub Document_Open()
    PrevSavedTime = ActiveDocument.BuiltInDocumentProperties(wdPropert yTimeLastSaved)
    End Sub
    </pre>

    The problem is that it *ALWAYS* thinks the doc has changed, and tries to send an email, whether I've changed the doc or not, and whether or not I've saved after making any changes. I've tracked the source of the problem down to the two variable assignments. I basically just commented out all the code and then explored when Word asks me if I want to save changes (the thing that would trigger the "If ActiveDocument.Saved = False" clause. If I comment out everything but the "PrevSavedTime =" assignment in the last subroutine, and the "Newtm =" assignment in the middle routine, Word *ALWAYS* asks me if I want to save, even if I haven't made any changes (just opening the doc and then trying to close it). So there seems to be something about making those assignments that causes word to think that the doc has been changed, even though it hasn't been.

    Anyone have any idea how to fix this problem?

    Thx. (PS: Sorry, I put appropritate indents in the code when I was drafting this message, but they don't appear in the final message. Don't know why.)

Posting Permissions

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