Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
udaya_kumar
Specialist
Specialist

Keep macro outside and call it from QlikView

Hi,

I have an export to excel macro which runs on a button click in a QlikView dashboard.

I want to keep the macro code outside QlikView (May be in a notepad) and just call it from QlikView macro module and run it.

Is it possible to do it in macro edit module similar to include statement in script?

Thanks in advance.

Labels (1)
2 Solutions

Accepted Solutions
marcus_sommer

Yes, it is. Take here a look on the suggestion from Rob: Include-external-module-macro-code

- Marcus

View solution in original post

udaya_kumar
Specialist
Specialist
Author

Take here a look on the suggestion from Rob: Include-external-module-macro-code

The above link helped me to solve the problem.

But we need to call the actual macro name inside the commonFunction.vbs file to execute it.

Calling IncludeCommon macro is not working for me.

Below is the macro code I used to call the another macro in an external vbs file.

Call IncludeCommon
Sub IncludeCommon
Dim objFSO, file, str
Set objFSO = CreateObject("Scripting.FileSystemObject")

set mypath = ActiveDocument.GetProperties
directory = mypath.MyWorkingDirectory
codefile = directory & "\commonFunctions.vbs"
Set file = objFSO.OpenTextFile(codefile)

str = file.ReadAll

ExecuteGlobal str

file.Close
End Sub

View solution in original post

4 Replies
marcus_sommer

Yes, it is. Take here a look on the suggestion from Rob: Include-external-module-macro-code

- Marcus

udaya_kumar
Specialist
Specialist
Author

Hi Marcus,

I used the code in the link provided in my file.

The IncludeCommon macro is not getting called from QlikView text box.

I have added it in a text box calling that macro with it's name, but when I click on it, nothing happens.

Thanks in advance.

marcus_sommer

Go into the modul editor and check the security-settings - it must be on system access. If this doesn't help, execute the macro from the modul to get any error-messages and you could further use some msgbox to see when the code breaks.
udaya_kumar
Specialist
Specialist
Author

Take here a look on the suggestion from Rob: Include-external-module-macro-code

The above link helped me to solve the problem.

But we need to call the actual macro name inside the commonFunction.vbs file to execute it.

Calling IncludeCommon macro is not working for me.

Below is the macro code I used to call the another macro in an external vbs file.

Call IncludeCommon
Sub IncludeCommon
Dim objFSO, file, str
Set objFSO = CreateObject("Scripting.FileSystemObject")

set mypath = ActiveDocument.GetProperties
directory = mypath.MyWorkingDirectory
codefile = directory & "\commonFunctions.vbs"
Set file = objFSO.OpenTextFile(codefile)

str = file.ReadAll

ExecuteGlobal str

file.Close
End Sub