Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macros

Hi ,

it's Very aurgent and important plzzz

i am having one  straight table .client want to see that by email,and also in  in excel ,means i should do it as export to excel.

i dont have any idea  about Macros plzzz guide  me step by step plzz i would be grate thank full to you plz.

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

1) Create a new sheet object: BUTTON

2) Add two ACTIONS to this object:

*  Action Type: External

   Action: Run Macro, Macro Name: SaveAsExcelAndMail

*  Action Type: External

   Action: Launch

   Application: CLICK BROWSE

      and find powershell.exe in c\windows\system32\windowspowershell\v.10\

      Parameters:

           ='Send-MailMessage -To ' & To & ' -From ' & From & ' -Subject ' & Subject & ' -Body ' & Body

              & ' -SmtpServer ' & [SMTP server] & ' -Attachments ' & [Attachement Filename]

3) In the Tool / Edit Module enter this Macro code:

Sub SaveAsExcelAndMail

  Set Obj = ActiveDocument.GetSheetObject("CH01")

  Obj.ExportBiff "<your-complete-filename>.xls"

End Sub

When you are in Edit Module you have to select in the two drop-downs on the left:

- Requested Module Security:   System Access

- Current Local Security:            Allow System Access

View solution in original post

6 Replies
petter
Partner - Champion III
Partner - Champion III

If you want to do it from QlikView Desktop this attached QVW will show you how to do it with at Macro and invoking PowerShell in Windows to perform a Send-MailMessage. This presumes that you use an SMTP server that does not require for you to use a username and password. By changing the parameters for Send-MailMessage you can accomodate user/password too....

Not applicable
Author

thanks for your response petter,

i opened the qvd.there is chart  and from address ok.and Macros code but step by step implementation i am missing

petter
Partner - Champion III
Partner - Champion III

1) Create a new sheet object: BUTTON

2) Add two ACTIONS to this object:

*  Action Type: External

   Action: Run Macro, Macro Name: SaveAsExcelAndMail

*  Action Type: External

   Action: Launch

   Application: CLICK BROWSE

      and find powershell.exe in c\windows\system32\windowspowershell\v.10\

      Parameters:

           ='Send-MailMessage -To ' & To & ' -From ' & From & ' -Subject ' & Subject & ' -Body ' & Body

              & ' -SmtpServer ' & [SMTP server] & ' -Attachments ' & [Attachement Filename]

3) In the Tool / Edit Module enter this Macro code:

Sub SaveAsExcelAndMail

  Set Obj = ActiveDocument.GetSheetObject("CH01")

  Obj.ExportBiff "<your-complete-filename>.xls"

End Sub

When you are in Edit Module you have to select in the two drop-downs on the left:

- Requested Module Security:   System Access

- Current Local Security:            Allow System Access

Not applicable
Author

Hi Peater Thanks For Your Grate Efforts.

='Send-MailMessage -To ' & To & ' -From ' & From & ' -Subject ' & Subject & ' -Body ' & Body

              & ' -SmtpServer ' & [SMTP server] & ' -Attachments ' & [Attachement Filename]

getting some errore in this part

Not applicable
Author

Hi

While Pasting Macros Code Errore Plz Help

Capture.PNG

petter
Partner - Champion III
Partner - Champion III

Do you have a Chart Object with an ID of CH01?

The first line of the Macro code tries to get a reference to a chart object with this ID. If it is not found it will assign null to Obj. Then the second line will give the error you got...

So you will have to create a Sheet Object that can be exported as an Excel Workbook and give it tge ID of CH01 or change the code to refer to CH02 or CH06 or whatever the ID is of the object you want to export and mail...