A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Hi Palcouk and anyone else who looks at this thread,
I believe I have found a solution to my problem. I suspected all along that my problem had something to do with my VBA code that refreshes my externally linked data in certain circumstances executing before the required server connections have been fully established and ready to serve up my data.
To test this theory, I added the following code at the beginning of my code that refreshes my externally linked data....
Dim StartTime As Double
Dim PauseTime As Double
PauseTime = 10
StartTime = Timer
Do While Timer < StartTime + PauseTime
DoEvents
Loop
... The VBA Timer function (I believe) returns the number of seconds that have elapsed since midnight. The DoEvents function (I believe) relinquishes control to Windows so that background tasks can be performed. My intention in the way I made use of these functions above was to delay execution of my "refresh" code for 10 seconds so that my server connections have ample time to become properly established before I attempt to use them.
After adding the code above, my "Refresh" code has worked properly in all scenarios in which I have tested it (Opening Excel first and doing File | Open, double-clicking on the .xlsm file, and when I open it using the scripting language behind an process visualization and control application I am working on.
So, I think I am good for now. I appreciate Palcouk's effort and anyone else who took the time to read my post.
Best regards,
Paul