Quote Originally Posted by xld
That seems robust, although I must admit to have never used, nor needed to use, such a technique. The Environ variables are loaded when Excel starts, it is not dynamic, but you probably don't need them to be dynamic.

But I fail to see why Application.Path returned the same value. It should be the path that the application is in, so if you start Excel on a server, you should get a server path.
I'm unsure of why the Application.Path method did not change in the SAS Server either. As I'm relatively inexperienced in Network programming (apart from using them), its difficult for me to understand why.

As for your comment on dynamic variables - what exactly did you mean? What is an example of a dynamic variable? Do you feel that this function is suitable given the following context:
- To give some context for this thread, the purpose of this thread was to batch SAS programs using Excel-VBA as a front end. SAS is only run from the SAS Server, in this case using specific VBIDE references to the SAS Server libraries. As such I want the User to close the workbook that runs the SAS programs if they are haven't opened it from the SAS server. Will the Environ variables ever cause problems for this purpose?

thanks and regards