Avatar of jpariso
 asked on

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.
Microsoft AccessRemote AccessVB ScriptVBA

Avatar of undefined
Last Comment
Gustav Brock

8/22/2022 - Mon
Gustav Brock

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.


Thanks Gustav for the quick resposne,


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.
Gustav Brock

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.

Well that was easy... and so far it works flawlessly!

Thanks for the help!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Gustav Brock

You are welcome!