ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   can't print excel sheet using wsh script (https://www.excelbanter.com/excel-programming/352990-cant-print-excel-sheet-using-wsh-script.html)

onedollar

can't print excel sheet using wsh script
 

Hi,

I'm trying to print a pdf by using a wsh script. Problem is Excel
complains that printing is not possible because the file is already in
use or locked, which is complete nonsense.

Set objXl = wscript.createobject ("Excel.Application")

objXl.DisplayAlerts = False
objXl.visible = true

Set objwb = objxl.workbooks.open("c:\temp\test.xls")
Set objwb = objXl.activeworkbook.worksheets("Tabelle1")

objXl.ActiveSheet.PrintOut ,,,,,,,"my.pdf"


Any ideas ?

TIA


--
onedollar
------------------------------------------------------------------------
onedollar's Profile: http://www.excelforum.com/member.php...o&userid=31407
View this thread: http://www.excelforum.com/showthread...hreadid=511028


Tom Ogilvy

can't print excel sheet using wsh script
 
Are you sure it is trying to write to my.pdf? I assume you are using some
special print driver to create a PDF - maybe it has a different way to
determine what file to write to.

--
Regards,
Tom Ogilvy


"onedollar" wrote
in message ...

Hi,

I'm trying to print a pdf by using a wsh script. Problem is Excel
complains that printing is not possible because the file is already in
use or locked, which is complete nonsense.

Set objXl = wscript.createobject ("Excel.Application")

objXl.DisplayAlerts = False
objXl.visible = true

Set objwb = objxl.workbooks.open("c:\temp\test.xls")
Set objwb = objXl.activeworkbook.worksheets("Tabelle1")

objXl.ActiveSheet.PrintOut ,,,,,,,"my.pdf"


Any ideas ?

TIA


--
onedollar
------------------------------------------------------------------------
onedollar's Profile:

http://www.excelforum.com/member.php...o&userid=31407
View this thread: http://www.excelforum.com/showthread...hreadid=511028





All times are GMT +1. The time now is 09:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com