Hi all,
Our partners in India are unable to run on our behalf a number of Excel-based macros, using Outlook to create e-mails, apparently due to the fact that they are working in a Citrix environment. As I don't have access to a Citrix environment, in which to try to replicate and resolve the problem, I'm looking to understand whether Citrix introduces any restrictions on linking applications in VBA.
I have given our partners this code to run:
Option Explicit
Dim objOutlook As Object
Dim strErrorMsg As String
Public Sub sTestOutlookUnderCitrix()
' System settings, just in case...
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
' Set the error trap
On Error Resume Next
' Try to find the Outlook application
Set objOutlook = GetObject(, "Outlook.Application")
' Check for results
If Err.Number <> 0 Then
' If there is an error, display the error result in the worksheet
strErrorMsg = "Error in assigning Outlook session." & vbCrLf & vbCrLf & "Error number: " & Err.Number & vbCrLf & vbCrLf & _
"Error description: " & Err.Description
Err.Clear
On Error GoTo 0
Range("B5").Value = strErrorMsg
Else
On Error GoTo 0
' If there is no error, display a success message in the worksheet
Range("B5").Value = "Test successful; Outlook session recognised."
' Remove the assignment of the Outlook session
Set objOutlook = Nothing
End If
' Reset system settings
With Application
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub
Display More
This results in the display of error 429 "ActiveX component can't create object" even though Outlook is open at the point of running the macro. I can replicate the problem in Windows (Excel 2013 / Office 365) if I close Outlook, but the test works fine if I have Outlook open.
I can potentially give our partners separate Excel and Outlook applications to run, but would prefer to combine them in one process if possible, so any insights into potential Citrix-specific issues would be appreciated.