Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey Guys,
I need help in writing a macro. It will need to open an outlook new message and set the to and subject line. Then the user can enter data in the message and send it.
Something like:
function openMail
Dim Outlook 'As New Outlook.Application
Set Outlook = CreateObject("Outlook.Application")
.To = "kallcorn@us-analytics.com"
.Subject = "Hello"
Set objEmail = Nothing
end function
Found out what I was doing wrong here is the code:
SUB openMail
Set vOlApp = CreateObject("Outlook.Application")
Set vMessage = vOlApp.CreateItem(olMailItem)
vMessage.Subject = "Test"
vMessage.To = "kallcorn@us-analytics.com"
vMessage.Display
END SUB
Dear Kallcorn,
I need the same macro solution. But I want to send the email for more than one email address. The email addresses are in the Email field. How can I modify your macro to send the email for all selected email address on the email fields.
Kind Regards,
Hi Asimakin,
I have done something similar, and here is the code. I read the values from a TableBox, but you should be able to do something similar with a Listbox
MyConcatenatedField= " "
for i = 1 to TableBox.GetRowCount-1
MyConcatenatedField= MyConcatenatedField& TableBox.GetCell(i,1).text & "; "
end if
next
Hi,
I have an error message with the above code. Would you please send a sample qlikview file?
Kind Regards,
Hello
This looks great and i would love to be able to use it but i get the following error message on the CreateObject line
ActiveX component can't create object: 'Outlook.Application'
Do you know how i can resolve this ? My macro code...
SUB openMail
Set vOlApp = CreateObject("Outlook.Application")
Set vMessage = vOlApp.CreateItem(olMailItem)
'******** Auto fill out email fields ***********
vMessage.Subject = "QlikView Support Request..."
vMessage.To = "paul.nockolds@haymarket.com"
vMessage.CC = "Somebody@Somewhere.com"
vMessage.Display
END SUB
Thanks for the reply
I've definitely got Outlook installed (and open) on my PC and have changed the Security settings as per your image file.
It now works when i click the Test button inside the Edit Module window but nothing happens when i click the button on my dashboard that the RunMacro action is attached to ??
Any ideas?
Brilliant thank you
I had the Macro Name in the Button Properties window different to the subroutine name in the edit module window.
It now works perfectly
Thanks again