Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with my codes- extra! macro

Status
Not open for further replies.

imanoob24

IS-IT--Management
Jan 19, 2017
1
CA
hello first post here, I need some help with my macro. I am doing a macro that will get the client information in Extra then send it to outlook using my template. The problem is I keep on getting error when I use outlook.application command in extra compiler. So when I use this sample codes in extra it will return an error. I want my codes to be short,
Sub Open_ol()

Dim OlApp As Outlook.Application
Dim Msg As Outlook.MailItem
Set OlApp = New Outlook.Application
Set Msg = OlApp.CreateItemFromTemplate("C:\Users\Win7\Desktop\testtemp.oft")
With Msg
.To = "me@yahoo.com"
.Subject = "This is a test"
.CC = "CCyou@gmail.com"
End With
Msg.Body = Replace(Msg.Body, "<client name>", & clName$)
Msg.Display
End Sub

***** Right now I have this super duper long code (Currently working code), and I want it to be simple. Whenever I call the outlook application it will return an error. ******

Sub notif_email()
Dim Letter_subject, Letter_from As String
Dim To_Email
Dim Email_Body
Get_Emails_From_Excel
F_date = Future_Date(3)
Email_Body = "Hello, " & Chr(13) & Chr(13)
Email_Body = Email_Body & "Bla bla bla bla lbalbalbalbal." & Chr(13) & Chr(13)
Email_Body = Email_Body & "Bla blab lbab balbal to save process. " & Chr(13) & Chr(13)

Email_Body = Email_Body & "Client name and number: " & Client_Name$ & Chr(13)
Email_Body = Email_Body & "Account number: " & User_Account & Chr(13)

Email_Body = Email_Body & "Total " & Chr(13)
Email_Body = Email_Body & "Value: " & Dollar_Form(Fund_Total) & Chr(13)
Letter_subject = "Notification of : " & Client_Name$ & " Client Number #" & use_account$
To_Email = Consultant_Name$


Letter_subject = Scrub(Letter_subject)
Email_Body = Scrub(Email_Body)

rc& = CreateProcessA(0&, "C:\Program Files\Microsoft Office\OFFICE12\OUTLOOK.EXE /c ipm.note /m " & To_Email & CC_Email & "&subject=" & Letter_subject & "&body=" & Email_Body, 0&, 0&, 0&, 0&, 0&, 0&, startup, processinfo)

End Sub

Thank you in advance. Hope someone can help me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top