Good Morning All:
I would like to thank all who contributed using automation from VFP. As usual I
gauge the project on what I learned! I and I learned lots!
Final issues and observations with solutions (of sorts!):
1. I learned the difference between createobject and getobject - in another
project using Word this will be invaluable
2. When I restarted my computer and ran the code the screen still flashed when
the doc was closed and the next opened - solved by changing the
object.application.windowstate = 0
0 - reset, 1 - maximized, 2-minimized. Then I issued
object.application.move(0,-3000) to get it not visible...in Excel the syntax is
object.application.top = -3000
So now all the docs would open and print in succession but there is one other
issue...the 'set printer to name' does not send the docs where they need to go.
Apparently this only works in VFP and not in automation. So...
3. The default printer needs to be set in Word and Excel. In Word:
object.ActivePrinter = GetPrinter() In Excel it is some really awful sequence
like object.Worksheets(1).Application.ActivePrinter = "Epson Stylus COLOR 740
ESC/P 2 on Ne01:" Aprinters() does not return the Ne01 but an IP address. The
Ne01: is stored in the registry at HKEY_CURRENT_USER\Software\Microsoft\Windows
NT\CurrentVersion\Devices then GetPrinter() name and finally the winspool,port.
Crazy stuff. Why (rhetorically is says) aren't they the same? Anyway what I
found was if Word and Excel objects are created the Word object.ActivePrinter =
GetPrinter() will also set the default printer in Windows therefore changing
the printer in Excel as well. Now when the docs were spooled they go where
expected.
4. Finally, on exit I reset the Windows default printer back to the default and
the window states and positions in Word and Excel as before. One other item:
set("printer",2) returns the Windows default printer in uppercase. When setting
the printer back to the default using the uppercase printer name in Word
object.SetActivePrinter returns an error. It must be set the same as the way it
is stored in the system. Aprinters() does return the way it is stored in the
system so that was used.
Again, thanks for the help!
Best regards,
Jack
Jack Skelley
Senior Director, Programming/Computer Operations
New Jersey Devils
(973)757-6164
[email protected]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/7d9e7f72b813014c8fd022cf04f820ed58637...@ex08.drdad.thenewarkarena.com
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.