Set myOlApp = CreateObject("Outlook.Application") on citrix

F

Fred Jones

I have been attempting to get the following script below to work on
Citrix. However, it is looking locally instead of to Citrix where
outlook resides. Anyone have a suggestion on how I might be able to
get it to run via Outlook via Citrix instead of Locally?


Thanks

FJ

Sub Auto_Open()
Dim v_attach As Variant
Dim v_cnt As Long
Dim v_message_len As Long

Set myOlApp = CreateObject("Outlook.Application")

For x = 1 To ActiveWorkbook.Sheets.Count
Sheets(x).Select



Set myItem = myOlApp.CreateItem(olMailItem)
Range("A2").Select
While ActiveCell.Value > ""
Set myRecipient = myItem.Recipients.Add(ActiveCell.Value)
ActiveCell.Offset(1, 0).Range("A1").Select
Wend
Range("B2").Select
While ActiveCell.Value > ""
Set myRecipient = myItem.Recipients.Add(ActiveCell.Value)
myRecipient.Type = 2
ActiveCell.Offset(1, 0).Range("A1").Select
Wend
Range("C2").Select
myItem.Subject = ActiveCell.Value
Range("D2").Select
myItem.Body = ActiveCell.Value & Chr(10)
v_message_len = Len(ActiveCell.Value) + 1
Range("E2").Select
v_cnt = 1
While ActiveCell.Value > ""
v_attach = ActiveCell.Value
ActiveCell.Offset(0, 1).Range("A1").Select
Set myAttachments = myItem.Attachments
myAttachments.Add v_attach, 1, v_cnt + v_message_len,
ActiveCell.Value
ActiveCell.Offset(1, -1).Range("A1").Select
v_cnt = v_cnt + 1
Wend
myItem.send
Next x


myOlApp.Quit
Application.Quit
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top