Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

VB function execution on Server not working!

Hi Qlik Community,

i have the following function defined and I'm calling this function in the script editor using the following statement:

     let x = sendmail('Test');

Note: variable is not doing anything in the function, and that's by design.

The function is basically opening the text file Maro_Err and writing the line Hello There. This is working when executing the script using the thick client. However when reloading the dashboard using QMC, the function sendMail is not doing anything. Any ideas? Is there any setting I can check on the server that is stopping the executing?

Your help is much appreciated. Thanks

function sendMail(variable)

     on error resume next

     Dim objFileToRead

'''Object to open text file

     Set objFileToWrite = CreateObject("Scripting.FileSystemObject").OpenTextFile("\\servername\Macro_Err.txt",2,true)    

'''''

     objFileToWrite.WriteLine("Hello There")

     objFileToWrite.Close

     Set objFileToWrite = Nothing

          'Clear the memory

          Set outobj = Nothing

          Set mailobj = Nothing

end function

7 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

It is because Macros are not supported in Ajax mode.. Try using the IE Pugins.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
petter
Partner - Champion III
Partner - Champion III

Visual Basic works also in Ajax but with limitations as documented in the QlikView Reference Manual.

The question does not mention Ajax but Load Script calling a VBScritical function.

petter
Partner - Champion III
Partner - Champion III

The server settings in the QMC have to allow execution of Macros. It could also be a matter of rights....

Not applicable
Author

So I don't think this has anything to do w/ Ajax vs. IE plugin. My reasoning is as follows:

The qvw has no frontend. My goal of this qvw is to set a reload task that on a predetermined frequency can refresh the dashboard and execute the macro. So I'm not even using the front end at all. Let me know if i'm mistaken.

Peter - I looked into your other comment about macro execution on server setting. This setting is enabled, yet the dashboard is still not write the string to the text file, as the function is instructed to do. Any ideas??

petter
Partner - Champion III
Partner - Champion III

Check these three things:

1) The reference to the file does not seem to be valid:

     \\servername\Macro_Err.txt

The structure of an UNC path to a file has to have at least three components

     \\servername\share\filename

2) The account that the server is running under has to have sufficient rights to the file that will be written to.

3) The file has to exist already since you are not creating the file but only opening it for writing.

marcus_sommer

Have a look here: Using EDX in QlikView 11 - basic example

- Marcus

petter
Partner - Champion III
Partner - Champion III

If you have additional feedback please pose more questions or if you feel that your question has been answered please close this thread by marking it as answered and if appropriate mark one or more answers as helpful