Hi
I have a macro that creates an email message and sets a link to a file in the the body of the email.
I want to write and additional sub that will allow the user to add other links to the body of the same message - is this possible? How would I do it? (I'm thinking there is probably a better way than what I am doing - )
This is my code. On the second Sub the problem I think is with the line containing
myOlApp.CreateItem(olMailItem)...
*** this sub creates a message and adds first link as body
Private Sub AddAction()
Dim FilePath, DocPath, DocName As String
FilePath = InputBox("What is the Directory of the attachment?", "File Path")
DocName = InputBox("What is the full name of the file?", "File Name")
DocPath = FilePath & "\" & DocName
Dim myOlApp As New Outlook.Application
Dim myItem As Outlook.MailItem
Dim myAction As Outlook.Action
Set myItem = myOlApp.CreateItem(olMailItem)
Set myAction = myItem.Actions.Add
myItem.Subject = "Attached files"
myItem.Body = vbCrLf & "file:\\" & ReplaceSpace(DocPath)
myItem.Display
End Sub
*** This sub SHOULD allow user to insert a new line into the message body
Private Sub MultiAtts()
Dim FilePath, DocPath, DocName As String
FilePath = InputBox("What is the Directory of the attachment?", "File Path")
DocName = InputBox("What is the full name of the file?", "File Name")
DocPath = FilePath & "\" & DocName
Dim myOlApp As New Outlook.Application
Dim myItem As Outlook.MailItem
Dim myAction As Outlook.Action
Set myItem = *** myOlApp.CreateItem(olMailItem)***
Set myAction = myItem.Actions.Add
myItem.Body = "file:\\" & ReplaceSpace(DocPath) & vbCrLf
myItem.Display
End Sub
Cheers
Crabback
I have a macro that creates an email message and sets a link to a file in the the body of the email.
I want to write and additional sub that will allow the user to add other links to the body of the same message - is this possible? How would I do it? (I'm thinking there is probably a better way than what I am doing - )
This is my code. On the second Sub the problem I think is with the line containing
myOlApp.CreateItem(olMailItem)...
*** this sub creates a message and adds first link as body
Private Sub AddAction()
Dim FilePath, DocPath, DocName As String
FilePath = InputBox("What is the Directory of the attachment?", "File Path")
DocName = InputBox("What is the full name of the file?", "File Name")
DocPath = FilePath & "\" & DocName
Dim myOlApp As New Outlook.Application
Dim myItem As Outlook.MailItem
Dim myAction As Outlook.Action
Set myItem = myOlApp.CreateItem(olMailItem)
Set myAction = myItem.Actions.Add
myItem.Subject = "Attached files"
myItem.Body = vbCrLf & "file:\\" & ReplaceSpace(DocPath)
myItem.Display
End Sub
*** This sub SHOULD allow user to insert a new line into the message body
Private Sub MultiAtts()
Dim FilePath, DocPath, DocName As String
FilePath = InputBox("What is the Directory of the attachment?", "File Path")
DocName = InputBox("What is the full name of the file?", "File Name")
DocPath = FilePath & "\" & DocName
Dim myOlApp As New Outlook.Application
Dim myItem As Outlook.MailItem
Dim myAction As Outlook.Action
Set myItem = *** myOlApp.CreateItem(olMailItem)***
Set myAction = myItem.Actions.Add
myItem.Body = "file:\\" & ReplaceSpace(DocPath) & vbCrLf
myItem.Display
End Sub
Cheers
Crabback