VBA Code to check Remote Desktop Status

I would like simple VBA code that checks the status of Remote Desktop status on the remote computer FROM the remote computer.

I run an Access Database on the remote computer via a remote desktop connection. I would like the code running on the remote computer to check it's Remote Desktop Status (i.e. is the computer being logged into via remote desktop?) so that I can run different code based on the result...

...Basically, when using remote desktop to run this database I would like the application to use a different set of printers than the ones used physically at the site.  All printing is currently handled through VBA code, so if I can get code for checking Remote Desktop status, then it's just a matter of modifying the current code.
jparisoAsked:
Who is Participating?
 
Gustav BrockCIOCommented:
Oh, I see.

You can use:

If Environ("sessionname") = "Console" Then
    ' Console user.
Else
    ' RDP user.
End If

/gustav
0
 
Gustav BrockCIOCommented:
That you can control by selecting smart printing on the host and let the users logon with a mark in Resources, Printers. Then the session will use the user's default printer for printing. but its own default printer for a physical user.

/gustav
0
 
jparisoAuthor Commented:
Thanks Gustav for the quick resposne,

but...

I am not looking for a workaround here. The only solution that will be accepted is one that uses vba code.  I don't mind using API calls from the code if need be.

The reason being, specifying printing will not be the only application for this.  There are all kinds of minor functionality issues that can be modified via code if I can establish if the program itself is being run through a remote session.
0
 
jparisoAuthor Commented:
Well that was easy... and so far it works flawlessly!

Thanks for the help!
0
 
Gustav BrockCIOCommented:
You are welcome!

/gustav
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.