I have a problem with automatic emailing some people with a macro.
The problem is getting the local fields to fill in the To-field and picking the right attachement.
In the attached qvw you can see my problem. I hope someone can tell me what i am doing wrong. Here is my code:
Sub Export rem get Possible Values set MailListbox = ActiveDocument.GetSheetObject("LB01") Mails=MailListbox.GetPossibleValues rem go through Values for mailcounter = lbound(Mails) to ubound(Mails) rem clear previous selections ActiveDocument.ClearAll false rem Select value ActiveDocument.Fields("MailID").Select Mails(mailcounter)
rem Action
Set vOlApp = CreateObject("Outlook.Application") Set vMessage = vOlApp.CreateItem(olMailItem) Set vToday = ActiveDocument.Variables("vToday") Set vReport = ActiveDocument.Fields("ReportName").GetSelectedValues Set vAdress = ActiveDocument.Fields("Adress").GetSelectedValues