Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 07-18-2023, 06:35 PM
juacab9 juacab9 is offline create macro to add category to email Windows 11 create macro to add category to email Office 2021
Novice
 
Join Date: Jul 2023
Posts: 12
juacab9 is on a distinguished road
Default Still gettting and error

Sub ReplyMSG()
'Graham Mayor - Graham Mayor - Home Page - Last updated - 18 Jul 2023
Dim olItem As Outlook.MailItem
Dim olAccount As Outlook.Account
Dim olReply As MailItem ' Reply
Dim olInsp As Outlook.Inspector


Dim wdDoc As Object
Dim oRng As Object
Dim bAcc As Boolean
Const strAcc As String = "Juan.Cabrera@pdmsteel.com" 'use the display name of the account here

On Error Resume Next
Select Case Outlook.Application.ActiveWindow.Class
Case olInspector
Set olItem = ActiveInspector.currentItem
Case olExplorer
Set olItem = Application.ActiveExplorer.Selection.Item(1)
End Select

For Each olAccount In Application.Session.Accounts
If olAccount.DisplayName = strAcc Then
bAcc = True
Set olReply = olItem.ReplyAll
With olReply
.BodyFormat = olFormatHTML
Set olInsp = .GetInspector
Set wdDoc = olInsp.WordEditor
Set oRng = wdDoc.Range(0, 0)
oRng.Text = "Am currently working on your quote, I should have it done today or first tomorrow morning. " & _
"Any question, please feel free to email directly."
oRng.collapse 0
oRng.Text = vbCr & vbCr & "Item 1" _
& vbCr & vbCr & "Item 2" _
& vbCr & vbCr & "Item 3"
.SendUsingAccount = olAccount
.Display
.Send
End With
Exit For
End If
olItem.Categories = "Juan Cabrera"
olItem.Close olSave
Next olAccount
If bAcc = False Then
MsgBox strAcc & " account not found!", vbCritical
End If
lbl_Exit:
Set olItem = Nothing
Set olReply = Nothing
Set olInsp = Nothing
Set wdDoc = Nothing
Set oRng = Nothing
Set olAccount = Nothing
Exit Sub
End Sub
Reply With Quote
  #17  
Old 07-18-2023, 06:41 PM
juacab9 juacab9 is offline create macro to add category to email Windows 11 create macro to add category to email Office 2021
Novice
 
Join Date: Jul 2023
Posts: 12
juacab9 is on a distinguished road
Default See attachment

For some reason it still not changing the email account.
Attached Images
File Type: jpg Untitled.jpg (56.8 KB, 8 views)
Reply With Quote
  #18  
Old 07-27-2023, 01:26 PM
juacab9 juacab9 is offline create macro to add category to email Windows 11 create macro to add category to email Office 2021
Novice
 
Join Date: Jul 2023
Posts: 12
juacab9 is on a distinguished road
Default

For some reason it still not change the email address
Reply With Quote
  #19  
Old 08-01-2023, 10:43 AM
juacab9 juacab9 is offline create macro to add category to email Windows 11 create macro to add category to email Office 2021
Novice
 
Join Date: Jul 2023
Posts: 12
juacab9 is on a distinguished road
Default

Help!!! Help!!!
Reply With Quote
  #20  
Old 08-02-2023, 04:50 AM
gmayor's Avatar
gmayor gmayor is offline create macro to add category to email Windows 10 create macro to add category to email Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,106
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

It is difficult to advise without access to the application, but you could try
Code:
.SentOnBehalfOfName = olAccount
in place of
Code:
.SendUsingAccount = olAccount
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #21  
Old 08-02-2023, 06:25 PM
juacab9 juacab9 is offline create macro to add category to email Windows 11 create macro to add category to email Office 2021
Novice
 
Join Date: Jul 2023
Posts: 12
juacab9 is on a distinguished road
Default

It still doesn't work, but it works in my mail box but not in the shared one i trying to use it in.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
create macro to add category to email Create a Userform in Outlook to select a macro for an email template. snickerbart Outlook 4 04-17-2015 12:55 PM
Create QuickStep: Save Contact with Category ilcaa72 Outlook 1 05-20-2014 10:31 AM
Macro to export email to text file on send depending on category Joe Patrick Outlook 0 10-19-2012 06:20 PM
How to create a Main category mirrored in Sub category data entry type of solution? Geza59 Excel 0 10-19-2012 05:44 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:51 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft