Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CLOSING MS WORD WITHOUT PROMPTING TO SAVE CHANGES
Message
From
10/03/2000 11:55:52
 
 
To
10/03/2000 06:21:22
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00343803
Message ID:
00344273
Views:
27
Hi Cetin,

You are always hiding out there ready to jump in a save me. Thanx ever so much. When I finish up with patients today I will sit down and play with your code. Thanx Again

Neil

>>Hi Dave,
>>
>>Nice to have you respond once again to one of my questions. The problem is that I open WORD up via automation. Play with it. Print the document and don't get back to VFP until I close WORD. So therefore, I close up before I would get to use Close(0).
>>
>>something like this:
>>
>>I create the word application object reference
>>I massage some of the document from my object reference
>>I make WORD visible
>>I do some other things to the document from within WORD
>>I print the document from within WORD
>>The following code keeps word the active app and keeps vfp quiet
>>
>>
>>
>> gHwndWord = GetForegroundWindow() && Save word window handle
>> Do while IsWindow(gHwndWord) # 0 && Wait while Word is alive
>> =inkey(.5)
>> Enddo
>>
>>Then I quit word, THE WORD handle is gone and I kill the reference to WORD with
>>
>>oWordDocument=.Null. && kill the beast and move on with vfp
>>
>>Now, I QUIT word from within word by hitting the close button not from my WORD APPLICATION reference.
>>Therefore, I can't use close(0)
>>
>>
>>Any thoughts?
>>
>>Neil
>>
>>
>>
>>
>>
>>
>>
>>
>>>Neil,
>>>
>>>Look in the vbawrdX help file, there is an optional argument to do this to the Close() I don't remember the method name off the top of my head method.
>>>
>>>>I have a place in my app where I enter WORD via automation. Because of some manipulations that I do to a document, WORD assumes that changes have been made and it prompts to save changes when I hot the close button. I don't want the prompt.
>>>>
>>>>Any body know how to close WORD, via hitting the close button, after making document changes without the save changes prompt?
>
>
Neil,
>You could bypass the dialog :
>oWord.ActiveDocument.Saved = .t.
>but in order to be able to do this you should track changes. You could do it by binding events to VFP events (VFPCOM). I don't know if that would work with versions older than word2000. I think you're not using word2000 (seeing getforegroundwindow()). It was the method I use too but dropped now for some quirks (such as user steps to another window while it's loading). Instead check the existence of a property. ie:
>
do while type("oWord.DisplayRecentFiles") # "U"
>enddo
And if this needs no user intervention than never set it to visible. ie: For long print operations I have the oWord scope to public, fire background printing, return to VFP and continue to work with other things (thanks to multitasking:), via a timer check if word has finished printing, if so oWord.quit and release oWord.
>Cetin
Previous
Reply
Map
View

Click here to load this message in the networking platform