Re: Word AUtomation by TonySper
TonySper
Wed Feb 16 11:50:30 CST 2005
Fred,
Thanks will see if that works for him.
TonySper
"Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
news:uzVwBi8EFHA.3512@TK2MSFTNGP10.phx.gbl...
oWord = CREATEOBJECT("Word.Application")
oWord.Documents.Open("C:\samples\fee.doc")
oWord.Visible = .t.
If you're relying on the end user to close down Word, you could then
just
do:
oWord = ""
Or if you want to close it through code:
oWord.Quit(.F.) && discard changes or just oWord.Quit() to prompt
you to
save changes.
oWord = ""
--
Fred
Microsoft Visual FoxPro MVP
"TonySper" <tsperduti@bellsouth.net> wrote in message
news:RToQd.1009$dr2.946@bignews6.bellsouth.net...
> Fred,
> Thanks for the reply. I had the user just go to the word.doc file
> and
> click on it to see if the association was there and it did open up
> the
> file. I will ask him to reload Microsoft Office as you have advised.
> Did you see anything out of the way with the way I coded or can I
> improve on the way I called the file??
> Can you give me an example of using a specific Open command in the
> Word object?
> TonySper
>
> "Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
> news:e2SI08vEFHA.1348@TK2MSFTNGP14.phx.gbl...
> You could use the specific Open commands in the Word object you
> create
> with
> CREATEOBJECT() in case that particular workstation doesn't have .DOC
> files
> associated with Word. Or you might need to reinstall word in case
> something
> is corrupted in either Word or the registry.
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "TonySper" <tsperduti@bellsouth.net> wrote in message
> news:v_bQd.326$dr2.74@bignews6.bellsouth.net...
>>I have several users running a program where I call an existing
>> Word.doc file using getobject. Only one of them is having a problem
>> with opening up a doc file. I am using the automation as below"
>>
>> *This is what is in the database lastid.lscript2
>> *C:\samples\fee.doc
>>
>> Selct 0
>> Use lastid
>>
>> FADR = alltrim(lastid.lscript2)
>>
>> oWORD = GetObject(FADR)
>> WITH oWORD
>> .APPLICATION.WINDOWSTATE = 1
>> .APPLICATION.VISIBLE = .T.
>> ENDWITH
>> Close Databases
>>
>> The reason why I am using a variable is that I open different
>> word.doc
>> files depending on selection of the user.
>>
>> Is there a better way to open an existing file using the word
>> automation??
>> Thanks in advance for all the help you all have given me in the
>> past.
>> TonySper
>>
>>
>
>
>