Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

VB Script Issue in creating WScript.Shell Object

Hi,

i have downloaded a document regarding creating a PDF Report, In That there is Macro function which have below

Function printReportPDF(pdfOutputFile)

Set WSHShell = CreateObject("WScript.Shell")

  WSHShell.RegWrite "HKCU\Software\QlikViewPDF\OutputFile", pdfOutputFile, "REG_SZ"

  WSHShell.RegWrite "HKCU\Software\QlikViewPDF\BypassSaveAs", "1", "REG_SZ"

Set WSHShell = nothing

End function

Same i had copied the macro in my QV file as below

Function printReportPDF_NEW(pdfOutputFile)

Set WSHShell = CreateObject("WScript.Shell")

  WSHShell.RegWrite "HKCU\Software\QlikViewPDF\OutputFile", pdfOutputFile, "REG_SZ"

  WSHShell.RegWrite "HKCU\Software\QlikViewPDF\BypassSaveAs", "1", "REG_SZ"

Set WSHShell = nothing

End function

But the downloaded document working fine , but in my document red marked line giving me error.

"ActiveX component can't create object: 'WScript.Shell' "

Kindly let me know why i am getting error in 1 document and not in other document.

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

This is usually due to the Module permissions. Open the Module Editor (Ctrl-m) and select "Allow System Access" in the Current Local Security dropdown.

-Rob

View solution in original post

10 Replies
vikasmahajan

Check have you install free pdf printer and sample demo

Hope this helps you

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Not applicable
Author

Hi,

i had check the same code which u have attached , your code is not giving error while running, same code i copied from your document to my document and its showing me the error on this line

Set WSHShell = CreateObject("WScript.Shell")

Error : "ActiveX component can't create object: 'WScript.Shell' "

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

This is usually due to the Module permissions. Open the Module Editor (Ctrl-m) and select "Allow System Access" in the Current Local Security dropdown.

-Rob

Not applicable
Author

Thanks Rob,

Its Working Now 🙂

Not applicable
Author

Hi Vikas,

For your example which PDF Creator Application u have used ?

fabio182
Creator II
Creator II

Hi Rob, I have a question

every time I run the macro I get a pop up where it tells me where I should store the file, there is some way to run the default route without having to pop up


imagen.png

fabio182
Creator II
Creator II

rwunderlichplease your support

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Can you post the macro you are running?

-Rob

fabio182
Creator II
Creator II

This is macro