|
-
Aug 4th, 2011, 04:41 AM
#1
Thread Starter
New Member
Error Object required: 'objExcel.ActiveWorkbook'
Hi,
I'm getting the below error On converting Excel to PDF using vbscript
Object required: 'objExcel.ActiveWorkbook'
Code: 800A01A8
I have given the code below
Const xlTypePDF = 0
Const ppSaveAsPDF = 32
if Wscript.Arguments.Count > 0 Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objExcel = CreateObject("Excel.Application")
For i = 0 to wscript.arguments.count - 1
Set objFile = objFSO.GetFile(WScript.Arguments(i))
dirPath = objFSO.GetParentFolderName(objFile)
fileBaseName = objFSO.GetBaseName(objFile)
objExcel.ActiveWorkbook.SaveAs dirPath & "\" & fileBaseName & ".pdf", ppSaveAsPDF
objExcel.ActiveWorkbook.Close(False)
Next
objExcel.Quit
Else
msgbox("Select a file to convert")
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|