Hi,
on one forum I found a maco to send e-mail but it doesn't work. I get an error "Run-time 91 Object variable or With block variable not set"
How can I fix it ?
Thanks for any help !
Sub Send_Margins()
Dim cdoConfig
Dim msgOne
Dim MI As Object
MI = Dir("C:\Users\Desktop\myfile.xlsm")
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "name of my SMTP server"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With
Set msgOne = CreateObject("CDO.Message")
Set msgOne.Configuration = cdoConfig
msgOne.To = "[email protected]"
msgOne.CC = ""
msgOne.From = "[email protected]"
msgOne.Subject = "hello"
msgOne.TextBody = "test test test"
msgOne.AddAttachment "C:\Users\Desktop\myfile.xlsm"
msgOne.Send
End Sub
Bookmarks