I have quite a complicated macro running in Outlook which saves emails. One of the features is to pop up a userform as soon as a outgoing email hits the sent items folder. The user can then choose to save the email to a folder, delete the email or simply leave it in the sent items. If the choose...
I am looking for a way of sending data from a userform in Outlook to an Excel spreadsheet.
At present the userform contains three textboxes and I need the data from the text box to pass to three cells in the spreadsheet on the same row e.g. textbox1 to A1 and textbox2 to B1 and textbox3 to C1...
I'm a dummy!
I've just realized that in your version of my code you were using msg.body and msg.subject whereas it should have been msgitem.body and msgitem.subject
Changing this has got it to work. Is there anyway of adding some line breaks after it inserts the hyperlink?
Thanks for your help
Unfortunately I still seem to be having problems. I used your code above that creates the task which compiles fine but when I try and run the macro I still get an error.
Thought it would be easier to post the full code I'm using.
I declared obJTask as Outlook.TaskItem as I think that was one of the issues I was having.
The code below works fine and creates a new task if the chknewtask value is true. However when I uncomment the lines of code you have suggested...
I managed to progress slightly further by enabling Microsoft Word 15.0 Object Library. However, I now get a cpile error at the following line of code
Set objInsp = objTask.GetInspector
I am using Outlook VBA to create the task and add the hyperlink rather than having an existing task and...
Thanks Diane. I tried your code but get a compile error for the following line of code
Dim objDoc As word.document
What I am trying to do is task.body = hyperlink
I'm trying to use VBA to add a hyperlink to a file on a server into an Outlook task body but can't get this to work. It seems the .htmlbody which works in messages doesn't work in tasks. Any ideas?
HI, I'm using the code below to remove illegal characters before saving an email in MSG format. At present the illegal characters are either replaced with a hyphen or an underscore. I would like to amend this to simply remove the illegal characters and not substitute e.g. hel&p would become help...
Error in code above as it was not setting the msgItemTo to the value of the first recipient. The correct code is below:
arrMsgTo = Split(msgItem.To, ";")
arrcount = UBound(arrMsgTo) - LBound(arrMsgTo) + 1
If arrcount = 1 Then
msgItemTo = msgItem.To
Else
msgItemTo = arrMsgTo(0)
End If
I think I've sorted it using:
arrMsgTo = Split(msgItem.To, ";")
arrcount = UBound(arrMsgTo) - LBound(arrMsgTo) + 1
If arrcount = 1 Then
msgItemTo = msgItem.To
Else
msgItemTo = LBound(arrMsgTo)
End If
I also had to set the arrMsgTo using
Dim arrMsgTo() As String
Thanks for the guidance Michael. I was hoping to use code something like that below to check whether there is more than one recipient and if so then set the Msgitemto string to something slightly different than if there was only one recipient. The code below seems to fail on the second line. How...
I have a script that saves emails in msg format in a specified filenaming format that includes Msgitem.to. At present if an email has been sent to multiple 'To' recipients the value of then my filename includes all the To recipients. I would like to change this to only include the first To...
I have the code below sitting on a module:
Sub MsgSaver(strPath As String, msgItem As Outlook.MailItem, lngCounter As Long, blnMulti As Boolean)
Dim intC As Integer
Dim intD As Integer
Dim strMsgSubj As String
Dim strMsgTo As String
'Set name to save message to
If...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.