I have the following VBA code for an E-Mail:
Sub Global_Email_Message()
Content = "<style> p {background-color: #d9d9d9} </style><p> This message should be global so I can use it in every sub for an E-Mail </p>"
If ExitAll = False Then
Set OApp = CreateObject("Outlook.Application")
Set OMail = OApp.CreateItem(0)
With OMail
.display
End With
signature = OMail.HTMLBody
With OMail
.To = "test@test.de"
.Subject = "test"
.HTMLBody = Content
End With
Set OMail = Nothing
Set OApp = Nothing
Else
End If
End Sub
This code works perfectly.
Now, I want to achieve that the message and the style in the variable "Content" is global so I can use it in different E-Mail-Subs. How can I globalize the "Content" variable for different E-Mail-Subs?
This message should be global so I can use it in every sub for an E-Mail
" and deleted the content variable from the Sub Global_Email_Message() but now it does not show any content in the E-Mail. – Michi May 30 '17 at 14:21