Word print.

Started by morenos1, January 06, 2017, 06:57:01 AM

Previous topic - Next topic

morenos1

This code fails to find the document in Windows 10 when I can see it there? .. (Windows 7 works..)

;   create word object...
oWord = objectopen("Word.Application")
;   set the documents object...
oDocs = oWord.documents
;   open a preset file...
oDocs.open("C:\temp\test.doc")
;get active document
oDoc = oWord.ActiveDocument
;   make word visible...
oWord.visible = @True ;Change to @False to hide
oWord.PrintOut(::FileName="C:\temp\test.doc")

oDoc.Save
oDoc.Close
oWord.Quit
ObjectClose(oDoc)
ObjectClose(oDocs)
ObjectClose(oWord)

td

You didn't mention which line generated the error and your exact script works just fine on one of our Windows 10 systems so it is hard to say why you are getting the error.  The Windows 10 usual suspect  is UAC but it is not clear how UAC would cause this error in this case.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

morenos1

Line 7. UAC disabled ....

morenos1


morenos1

Sorry this is the correct error line:

td

Quote from: morenos1 on January 06, 2017, 07:49:45 AM
Line 7. UAC disabled ....

'UAC dispabled' can mean different things to different people.  It can mean that UAC prompting is turned off which is not that same thing as UAC being turned off.  Or it can mean that either directly via the registry or group policy UAC is completely disabled.  If the later is the case, administrators are not able to run 'Modern' apps nor modify certain system settings via the systems 'Settings' applet.  But again this may be a red-herring.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

morenos1

Set to "Never notify". However, I can see the document in explorer and, open it with word ...

td

Assuming  you are using an admin account then that means that you are opening the document as a restricted admin from Explorer and as a full admin from WinBatch.    It is unclear how that would cause your problem unless the directory or file had some very unusual permissions or the 'temp' directory is some kind of reparse point.

You could experiment with opening the file readonly but not sure that this would help any.

https://msdn.microsoft.com/en-us/library/office/ff835182.aspx
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

You could also try renaming your script's file extension from '.wbt' to '.wbt_if'.  This could confirm or eliminate UAC as the problem.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

morenos1

For some reason the word files are saved as:  filename.doc.docx ??

As soon as I deleted .docx the file was found ......

Thank You ....

td

If you uncheck the Explorer Folder Option "Hide extensions for known file types" option, file extensions will always be visible from an Explorer window.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade