Hi,

Is there any way to launch a Word application from within VFP with all
prompts /errors suppressed such as errors asking to replace the NORMAL.DOT
file,etc.

Thanks

Zoom

RE: How to launch Word application from within VFP with all prompts / by Allan

Allan
Tue Apr 10 04:14:00 CDT 2007

If you simply want to print an MS Word.doc and do not want to see either the
print progress dialog or an instance of MS Word, try the following:

LOCAL lcFile, oWord, oDocument, hWin, lnAnswer, llContinue

lcFile = GETFILE('DOC')

IF EMPTY(lcFile)
RETURN .F.
ENDIF

DECLARE INTEGER GetDesktopWindow IN WIN32API
DECLARE INTEGER LockWindowUpdate IN WIN32API INTEGER lnHandle

llContinue = .F.

*-- Check if Word is already running, then create an instance of it.
TRY
oWord = GetObject(,'Word.Application')
CATCH WHEN .T.
oWord = CreateObject('Word.Application')
FINALLY
llContinue = (TYPE('oWord') == 'O')
ENDTRY

IF !llContinue
=MESSAGEBOX("Microsoft Word is not present in your system!" + CHR(13) + ;
"Please install the application first then try again.",;
48, "MS Word not Installed")

RETURN .F.
ENDIF

oDocument = oWord.Documents.Open(lcFile)

oWord.Options.PrintBackGround = .F.

hWin = _screen.HWnd && Object reference to active VFP window
=LockWindowUpdate(hWin)

lnAnswer = MESSAGEBOX('Do you want to print ' + CHR(13) +;
lcFile + '?',;
4 + 32 + 0,;
'Print file')

IF lnAnswer = 6 && Yes
oDocument.PrintOut()
ENDI

=LockWindowUpdate(0)

oDocument.Close()
oWord.Quit()
RELEASE oWord


"Zoom" wrote:

> Hi,
>
> Is there any way to launch a Word application from within VFP with all
> prompts /errors suppressed such as errors asking to replace the NORMAL.DOT
> file,etc.
>
> Thanks
>
> Zoom
>
>
>

Re: How to launch Word application from within VFP with all prompts / by Zoom

Zoom
Tue Apr 10 18:12:06 CDT 2007

I still get NORMAL.DOT errors stating the file is in use by another
instance. Is there any way to suppress these errors?

Zoom
"Allan" <Allan@discussions.microsoft.com> wrote in message
news:B6ED6BF3-B1E5-4E40-8527-72C99F101BAC@microsoft.com...
> If you simply want to print an MS Word.doc and do not want to see either
> the
> print progress dialog or an instance of MS Word, try the following:
>
> LOCAL lcFile, oWord, oDocument, hWin, lnAnswer, llContinue
>
> lcFile = GETFILE('DOC')
>
> IF EMPTY(lcFile)
> RETURN .F.
> ENDIF
>
> DECLARE INTEGER GetDesktopWindow IN WIN32API
> DECLARE INTEGER LockWindowUpdate IN WIN32API INTEGER lnHandle
>
> llContinue = .F.
>
> *-- Check if Word is already running, then create an instance of it.
> TRY
> oWord = GetObject(,'Word.Application')
> CATCH WHEN .T.
> oWord = CreateObject('Word.Application')
> FINALLY
> llContinue = (TYPE('oWord') == 'O')
> ENDTRY
>
> IF !llContinue
> =MESSAGEBOX("Microsoft Word is not present in your system!" + CHR(13) +
> ;
> "Please install the application first then try again.",;
> 48, "MS Word not Installed")
>
> RETURN .F.
> ENDIF
>
> oDocument = oWord.Documents.Open(lcFile)
>
> oWord.Options.PrintBackGround = .F.
>
> hWin = _screen.HWnd && Object reference to active VFP window
> =LockWindowUpdate(hWin)
>
> lnAnswer = MESSAGEBOX('Do you want to print ' + CHR(13) +;
> lcFile + '?',;
> 4 + 32 + 0,;
> 'Print file')
>
> IF lnAnswer = 6 && Yes
> oDocument.PrintOut()
> ENDI
>
> =LockWindowUpdate(0)
>
> oDocument.Close()
> oWord.Quit()
> RELEASE oWord
>
>
> "Zoom" wrote:
>
>> Hi,
>>
>> Is there any way to launch a Word application from within VFP with all
>> prompts /errors suppressed such as errors asking to replace the
>> NORMAL.DOT
>> file,etc.
>>
>> Thanks
>>
>> Zoom
>>
>>
>>



Re: How to launch Word application from within VFP with all prompts / by Dan

Dan
Tue Apr 10 22:58:42 CDT 2007

Your description is shifting around a bit.

If you are getting prompts to save normal.dot on shutdown, first make sure
you've disabled the Norton Antivirus toolbar for office. It's notorious for
causing these prompts when they're unnecessary.

If you visit the microsoft.public.word.docmanagement newsgroup, the lovely
Word MVPs there will gladly provide a link to a page that fully describes
this phenomenon.

Another thing that can cause prompts to save the template are settings in
Tools->Options in Word that cause direct formatting in the document to write
changes in the base styles in the attached template. Again, the Word MVPs
will happily point you to the document they've written that clearly explains
this.

In normal operation, template settings (such as normal.dot) are copied to
new documents and the template is never again referenced except to run macro
code. If you have changed any of Word's settings so that document changes
get written back to the template, you will ALWAYS have this problem.

The BAD news about all this is that sometimes Word changes these settings on
its own, and nobody really knows why.

ALL of these are frequently asked questions in the Word newsgroups, and they
have ready-made answers.

Your best answers to Word questions will come from the people who know Word
best, and they're the closest "community" I've seen to the VFP community
when it comes to being helpful and sharing knowledge.

And you might make new friends. They're fun, too!

Dan


"Zoom" <keashdoc@hotmail.com> wrote in message
news:OOSdnRM3UM5bhIHbnZ2dnUVZ_uSgnZ2d@comcast.com...
>I still get NORMAL.DOT errors stating the file is in use by another
>instance. Is there any way to suppress these errors?
>
> Zoom
> "Allan" <Allan@discussions.microsoft.com> wrote in message
> news:B6ED6BF3-B1E5-4E40-8527-72C99F101BAC@microsoft.com...
>> If you simply want to print an MS Word.doc and do not want to see either
>> the
>> print progress dialog or an instance of MS Word, try the following:
>>
>> LOCAL lcFile, oWord, oDocument, hWin, lnAnswer, llContinue
>>
>> lcFile = GETFILE('DOC')
>>
>> IF EMPTY(lcFile)
>> RETURN .F.
>> ENDIF
>>
>> DECLARE INTEGER GetDesktopWindow IN WIN32API
>> DECLARE INTEGER LockWindowUpdate IN WIN32API INTEGER lnHandle
>>
>> llContinue = .F.
>>
>> *-- Check if Word is already running, then create an instance of it.
>> TRY
>> oWord = GetObject(,'Word.Application')
>> CATCH WHEN .T.
>> oWord = CreateObject('Word.Application')
>> FINALLY
>> llContinue = (TYPE('oWord') == 'O')
>> ENDTRY
>>
>> IF !llContinue
>> =MESSAGEBOX("Microsoft Word is not present in your system!" + CHR(13) +
>> ;
>> "Please install the application first then try again.",;
>> 48, "MS Word not Installed")
>>
>> RETURN .F.
>> ENDIF
>>
>> oDocument = oWord.Documents.Open(lcFile)
>>
>> oWord.Options.PrintBackGround = .F.
>>
>> hWin = _screen.HWnd && Object reference to active VFP window
>> =LockWindowUpdate(hWin)
>>
>> lnAnswer = MESSAGEBOX('Do you want to print ' + CHR(13) +;
>> lcFile + '?',;
>> 4 + 32 + 0,;
>> 'Print file')
>>
>> IF lnAnswer = 6 && Yes
>> oDocument.PrintOut()
>> ENDI
>>
>> =LockWindowUpdate(0)
>>
>> oDocument.Close()
>> oWord.Quit()
>> RELEASE oWord
>>
>>
>> "Zoom" wrote:
>>
>>> Hi,
>>>
>>> Is there any way to launch a Word application from within VFP with all
>>> prompts /errors suppressed such as errors asking to replace the
>>> NORMAL.DOT
>>> file,etc.
>>>
>>> Thanks
>>>
>>> Zoom
>>>
>>>
>>>
>
>



Re: How to launch Word application from within VFP with all prompts / errors suppressed? by Olaf

Olaf
Wed Apr 11 06:28:59 CDT 2007

> Is there any way to launch a Word application from within VFP with all
> prompts /errors suppressed such as errors asking to replace the NORMAL.DOT
> file,etc.
Does word start with such a prompt, if
manually started? Then perhaps fix that
problem within word?

I had this problem sometimes simply
due to a misconfiguration of templates.

It also mayy be as simple as a missing
network drive or a wrong assigned drive
letter for such a drive.

Bye, Olaf.