Trevor3007
Well-known Member
- Joined
- Jan 26, 2017
- Messages
- 667
- Office Version
- 365
- Platform
- Windows
Good evening,
I currently use this code:-
I dont have te VB knowledge ( the above was created by someone who has). The above works fine but i ould like it only to open the *.oft file and not prompt for an eamil address to be inserted 1st then open the *. oft file ?
Or alternitively , keep the email request, but able to not enter a eamil address & just open the *.oft file Perhaps use a 'Yes No?
Thanks in advance & hope you can help.
I currently use this code:-
VBA Code:
Sub template()
Dim theEmailAddress As String
theEmailAddress = InputBox("Please enter an email address...", Title:="Email Address")
If Len(theEmailAddress) = 0 Then Exit Sub 'user cancelled or omitted the email address
'here you will need to validate the email address
Dim newItem As MailItem
Set newItem = Application.CreateItemFromTemplate("D:\work\template.oft")
With newItem
.Display
.To = theEmailAddress
.Body = "Hi " & Split(theEmailAddress, ".")(0) & "," & vbCrLf & vbCrLf & .Body
.GetInspector.WordEditor.Application.Selection.endkey unit:=6 'optional (to position cursor after the salution)
End With
I dont have te VB knowledge ( the above was created by someone who has). The above works fine but i ould like it only to open the *.oft file and not prompt for an eamil address to be inserted 1st then open the *. oft file ?
Or alternitively , keep the email request, but able to not enter a eamil address & just open the *.oft file Perhaps use a 'Yes No?
Thanks in advance & hope you can help.