M
Mike Loux
Does anybody know why there does not seem to be a .NET equivalent
(using the Primary Interop Assemblies) for SendKeys in Word? It's
very doable in Excel, but apparently not in Word (except via VBA).
I am maintaining a .NET app that accesses Word (update of a legacy
application, so I am locked into using that and not macros or add-ins,
unfortunately) via the (admittedly archaic) DSOFramer control, and I
am trying to programmatically close the Print Preview window if it is
open before attempting to save and close a document externally. If I
do not do this, then the application throws an exception ("Cannot
access document when in modal condition").
I am able to grab the application handle and determine if the
Print Preview window is open, but I cannot figure out how to close
it. If this were Excel, then I could just do a Application.SendKeys
("{Esc}") and all would be well, but I can't seem to do that in Word
(and it's frustrating as heck).
Anybody have ideas? Thanks!
(using the Primary Interop Assemblies) for SendKeys in Word? It's
very doable in Excel, but apparently not in Word (except via VBA).
I am maintaining a .NET app that accesses Word (update of a legacy
application, so I am locked into using that and not macros or add-ins,
unfortunately) via the (admittedly archaic) DSOFramer control, and I
am trying to programmatically close the Print Preview window if it is
open before attempting to save and close a document externally. If I
do not do this, then the application throws an exception ("Cannot
access document when in modal condition").
I am able to grab the application handle and determine if the
Print Preview window is open, but I cannot figure out how to close
it. If this were Excel, then I could just do a Application.SendKeys
("{Esc}") and all would be well, but I can't seem to do that in Word
(and it's frustrating as heck).
Anybody have ideas? Thanks!