I have made a macro in outlook 2003 and now i have a problem with it on only one machine. When macro need access to mails i should get a warning "A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this?" but int this case nothing happens, please tell me how can i test this . I phoned to M$ and they told me that there is no way to block this warning so this is a macro problem, does anybody know how can i solve this problem ??
Security level i set to medium and macro runs but when it's trying to get to mails nothing happens, somewhere this access is blocked. Ealier this macro worked on this computer without any problems.
[VBA]
Dim myItems, myItem, myAttachments As Object
Dim str, str2 As String
Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection
Dim objMail As Outlook.MailItem
On Error Resume Next
'work on selected items
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection
Set objMail = myOlApp.CreateItem(olMailItem)
k = 1
'for all items do...
For Each myItem In myOlSel
With objMail
'Set body format to HTML
.BodyFormat = olFormatHTML
.HTMLBody = myItem.HTMLBody +
.Subject = myItem.Subject
For i = 1 To myAttachments.Count
myAttachments(i).SaveAsFile ("c:\windows\Temp\" & myAttachments(i).DisplayName)
.Attachments.Add ("c:\windows\Temp\" & myAttachments(i).DisplayName)
Next i
.Save
End With
Next
End
[/VBA]
i know that this code could be much simple but i'm new to VBA
All i need is to get mail, copy it with attachments add some values from simple form and send it to a certain address, this macro above does it but (i didn't paste all code only the most important part ) but if you know easier way to accomplish this task i will be very thankful.