Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Major problem when parsing and minimizing a doc?? (Word 97)

    Hi,

    I have a pretty major problem. I am writing an app. which parses the document content (wrappinh bold and italic HTML symbols around the text etc...)

    I am trying to hide the parsing from the user (using ActiveWindow.WindowState = wdWindowStateMinimize) , so once they click the 'Start Parsing' button, the document is supposed to remain hidden until the parsing is completed, then maximise itself again.

    The problem I am having is when the document is minimized and the parsing begins, if any other word documents are open, the parsing code all points at the other open word document and not the one which is supposed to be parsed.

    This results in all sorts of errors. Any ideas on how to get round this? My basic aim to keep the parsing hidden from the user until it is complete, then displaying the document again.

    I hope this makes sense. Any help would be much appreciated [img]/forums/images/smilies/smile.gif[/img]

    Thanks,

    Chris

  2. #2
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Major problem when parsing and minimizing a doc?? (Word 97)

    Chris,

    Instead of minimizing the document, just turn Word's screen updating off

    Application.ScreenUpdating = False

    at the start of the routine and

    Application.ScreenUpdating = True

    at the end to allow the screen to update again.

    An added bonus is that your code will run faster.

    The only thing to watch out for is, make sure you have good error handling in your code.
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  3. #3
    2 Star Lounger
    Join Date
    Nov 2001
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Major problem when parsing and minimizing a doc?? (Word 97)

    Bryan,

    Thank you so much! Now, if I can just change this mouse pointer to an hour glass...

    Thanks again!

    Chris

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

    Re: Major problem when parsing and minimizing a doc?? (Word 97)

    system.Cursor = wdCursorWait

    StuartR

  5. #5
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Major problem when parsing and minimizing a doc?? (Word 97)

    Chris,

    However useful turning ScreenUpdating off can be, based on your original post, it doesn't sound like that will fix the problem - i.e. the code is running on the wrong document.
    If you do still have that problem even with screen updating set to off, you may be able to control which document the code works on, by setting an object reference to that document before you minimize it, and then having the code refer to for ex. "objActiveDoc.DoSomething" rather than "ActiveDocument.DoSomething.

    I used to use that 'minimize active doc window' trick too in Word 97 (can't use it in Word 2000), but from painful experience learned that I needed to enforce that only the one document was open, before my macro utility could run - you can put in code to test whether Documents.Count is greater than 1, and if it is, display a message box telling the user to close all other documents except the one you are going to process.

    Gary

Posting Permissions

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