Mike - that's what I figured - he was trying to print multiple Doc's in a
single "session" of the Word Automation - and the Doc's after the 1st is
causing the problem. I figured like you suggested - that he should only
print 1 Doc at a Time - and do the Automation object again for each Doc.
Downside - Automation is already Intrinsically slow - so - to redo the
Automation Object each time for multiple Doc's would make things even
painfully slower.
Maybe will its occurring - Jack should put a Dancing Cat animation on the
screen to entertain the Users!!!
:-)
-----Original Message-----
From: ProfoxTech [mailto:[email protected]] On Behalf Of Mike
Copeland
Sent: Thursday, May 09, 2013 3:19 PM
To: [email protected]
Subject: Re: Print A Word Document From VFP
Glad you got it working, Jack. Had another thought while reading your
post...
What if you release the Word object after each printed document, then
recreate it (the Word object)? Maybe that would prevent the "flash"?
I would suspect that the flash you're seeing is an opening-file dialog
confirmation of some sort that only happens (in the Word code) when you
open a document while Word is active...either that or the close command.
Did you see the flash if there were only one document to print? I am
guessing you didn't so it wouldn't be the close command.
Mike Copeland
-------- Original Message --------
Subject: Re: Print A Word Document From VFP
From: Jack Skelley <[email protected]>
To: [email protected]
Date: 5/9/2013 2:08 PM
Good Afternoon Ted:
Thanks for the great reply! Some really good info in those links you sent.
I appreciate your input.
I still can't figure out why the first doc printed is 'silent' and the
rest flash the screen. It's not the splash screen as they talk about in the
links but the actual interface. I sent commands to resize the display and
move it but didn't include it in the code.
I use the macro building functions in the Office apps then look at the
code and convert to Fox speak.
Here is what I am currently using and it works very well.
for i = 1 to alen(laQueue,1)
thisform.lstAttachments.listindex = laQueue(i,2)
wait window "Queuing " + laQueue(i,1) + "..." nowait
thisform.txtDocument.value = laQueue(i,1)
thisform.txtDocument.refresh()
do case
case laQueue(i,3) = "Word..."
oWord = createobject("Word.Application")
oWord.visible = .f.
oWord.Documents.Open(laQueue(i,1))
oWord.Application.PrintOut()
oWord.Quit(0)
case laQueue(i,3) = "Excel..."
oExcel = createobject("excel.application")
oExcel.visible = .f.
oExcel.Workbooks.Open(laQueue(i,1))
oExcel.DisplayAlerts = .f.
oExcel.ActiveWorkbook.PrintOut()
oExcel.activeworkbook.close()
oExcel.quit()
endcase
gaWord_docs(laQueue(i,2),1) = "PRT~~~" + justfname(laQueue(i,1))
thisform.lstAttachments.refresh()
lnPrinted = lnPrinted + 1
thisform.txtDocs_printed.value = lnPrinted
thisform.txtDocs_printed.refresh()
endfor
I know it isn't the slickest code around but there is no screen flash and
it works. I guess that's most important!
I appeciate the input!
Best regards,
Jack
Jack Skelley
Senior Director, Programming/Computer Operations
New Jersey Devils
(973)757-6164
[email protected] ________________________________________
From: ProfoxTech [[email protected]] on behalf of Ted Roche
[[email protected]]
Sent: Thursday, May 09, 2013 9:05 AM
To: [email protected]
Subject: Re: Print A Word Document From VFP
On Wed, May 8, 2013 at 11:37 AM, Jack Skelley
<[email protected]>wrote:
Ted and Frank:
Thanks for the tips.
Shellexecute still flashes Word and then the document on the screen. The
effect is even worse than in automation.
When I used nShowWin = 2 it appears in a smaller state but still flashes.
"Flashing word" means the splash screen for Word fires? You can suppress
that. A quick Google should point out a couple of solutions.
Perhaps adding the /q command line?
See:
http://lifehacker.com/5877847/start-microsoft-office-programs-without-the-sp
lash-screen
You can also avoid showing a blank Word doc and then the actual file with
the /t commandline switch, apparently:
http://office.microsoft.com/en-us/word-help/command-line-switches-for-micros
oft-office-word-2007-HP010164010.aspx
http://support.microsoft.com/kb/210565
As for not showing the document, I'm not sure. Automation may be the
solution, I guess.
But returning to the original question, if you're only printing static
documents, it's overkill to load an entire word processor, too. You're not
"processing words," editing and manipulating, you just want to print.
Would
it be feasible to use "output documents" like PDF or Microsoft's X??
whatever they are documents, rather than "editable documents?"
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---