0
I have a simple VBA script to cycle through a list of email addresses in Excel and send email with individual attachments. This works fine, and emails are sent from my primary/default account that is tied to the exchange server which is the same account that I use to login to my company's PC. I have access to another shared outlook account and I can see both my personal and the shared account in outlook. How can i change the below VBA script to send emails from the shared account. In other words, is there a way to specify a specific email account to open and send emails using this script?
Dim sh As Worksheet
Dim OA As Object, msg As Object
Dim i As Integer, j As Integer
Set sh = ThisWorkbook.Sheets("Sheet1")
Set OA = CreateObject("Outlook.Application")
j = Application.WorksheetFunction.CountA(sh.Range("A:A"))
For i = 2 To j
Set msg = OA.CreateItem(0)
msg.To = sh.Range("A" & i).Value
msg.cc = sh.Range("B" & i).Value
msg.Subject = sh.Range("C" & i).Value
msg.Body = sh.Range("D" & i).Value
If sh.Range("E" & i).Value <> "" Then
msg.attachments.Add sh.Range("E" & i).Value
End If
msg.send
Next i