Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
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

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

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

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

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

Can you post the macro you are running?

-Rob

fabio182
Creator II
Creator II

This is macro