Excel VBA under Local, Terminal Server and Citrix environments

masskadir

New Member
Joined
Feb 24, 2014
Messages
1
Hi Folks,
Interesting situation here with the environ(SESSIONNAME) function.
I need to know from which environment the Excel is running from: local, TS or Citrix.
I run an .xls on local machine under Excel 03, on TS under Excel 03 and on Citrix under 2013. The xls is run by the users in either 2 methods:

1. start up Excel THAN open the xls file, or
2. double-click on the xls file in Winexplorer which opens an instance of Excel.

On the local machine the resulting value is "Console". Just what I want.
SESSIONNAME=Console

On TS virtual machine, boths methods returns a value beginning with "RDP-". Again just what I want.
SESSIONNAME=RDP-Tcp#30

On Citrix virtual machine, method 1 returns a value "ICA-"
SESSIONNAME=ICA-TCP#1
which is fine but in method 2 the sessionname is no where to be found.
I used the following code to get all environ() function values.
Option Explicit
Sub GetEnvironVariables()
' ---------------------------------------------------------
' List all the available Environ information
' Environ Function returns info about the operating system
' Info will be listed in the Immediate Window (Ctrl+G)
' ---------------------------------------------------------
' ---------------------------------------------------------
' To ensure you see the result, I used SendKeys to open
' the vbe, and then display the Immediate Window
SendKeys "%{F11}", True
SendKeys "^g", True
GoTo RunProc
' ---------------------------------------------------------

RunProc:
Dim i As Integer
i = 1
While Environ(i) <> Empty
Debug.Print Environ(i), i
i = i + 1
Wend
End Sub

Can you help me determine what is going on here?
Is it a Citrix profile or security problem or Excel 2013 reacting differently?
Thanks
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top