I got the following from How to add default signature in Outlook. However, I keep getting an error "Application-defined or object-defined error" where the signature variable is set. How can I fix this error?
Dim OApp As Object, OMail As Object, signature As String
Set OApp = CreateObject("Outlook.Application")
Set OMail = OApp.CreateItem(0)
With OMail
.Display
End With
signature = OMail.body
With OMail
'.To = "[email protected]"
'.Subject = "Type your email subject here"
'.Attachments.Add
.body = "Add body text here" & vbNewLine & signature
'.Send
End With
Set OMail = Nothing
Set OApp = Nothing
I know I could get the signature from the C:Users...Signatures folder. However at work, we all use virtual desktops and the permissions there are a tad janky.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…