Hello all,
I'm having trouble saving the outlook item. (Hmmm, I just realized I'm working with Ms Word - does it matter? Can I still post here?) Anyways, the issue is that, Word is creating the Message and sending it just fine (with attachments, subject and everything), but it is not saving the file in the designated location properly. It is saving as 1 KB and not opening. Below is the code and an image of the error. Thanks much for your help!
Hmmm, I can't seem to attach an image from my PC (not seeing the option.) Anyhoo, the message basically says the file does not seem to exists, or cannot be open.
Thanks much for your help!!
I'm having trouble saving the outlook item. (Hmmm, I just realized I'm working with Ms Word - does it matter? Can I still post here?) Anyways, the issue is that, Word is creating the Message and sending it just fine (with attachments, subject and everything), but it is not saving the file in the designated location properly. It is saving as 1 KB and not opening. Below is the code and an image of the error. Thanks much for your help!
Code:
Private Sub CommandButton1_Click()
Dim myString As String
Dim myString2 As String
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
' Doing some texts replacements here.
myString = Label9
myString = Replace(myString, "[Name of Person]", TextBoxNoP.Value)
myString = Replace(myString, "[Name of Establishment]", TextBoxNoE.Value)
myString = Replace(myString, "[Date Received]", TextBoxDR.Value)
myString2 = Label10
myString2 = Replace(myString2, "[Name of Establishment]", TextBoxNoE.Value)
myString2 = Replace(myString2, "[Date Received]", TextBoxDR.Value)
' Done with texts replacements here. Setting up, saving and sending messages.
Set myAttachments = myItem.Attachments
myItem.To = TextBoxTo.Value
myItem.CC = TextBoxCC.Value
myItem.Subject = myString2
myAttachments.Add "\\di-afs.doi-ad.state.nv.us\LifeHealth\Charitable Gift Annuities\Charitable Gift Annuities 2016\Pending Charitable Gift Annunites\" & TextBoxAtt.Value & ".pdf"
myItem.Body = myString
myItem.SaveAs "\\di-afs.doi-ad.state.nv.us\LifeHealth\Charitable Gift Annuities\Charitable Gift Annuities 2016\E-mails sent by Nanci\" & myString2 & ".msg", olMsg
myItem.Send
Unload Me
End Sub
Hmmm, I can't seem to attach an image from my PC (not seeing the option.) Anyhoo, the message basically says the file does not seem to exists, or cannot be open.
Thanks much for your help!!