GetObject
Apr 4, 2009I wrote this code to update(export) 3 cells data to an external spreadsheet. Both spreadsheets are running. I wrote the code with both spreadsheets on one computer just to make sure I had it working. Which it does(like a charm). But when I try to run this over a network there's where it gets into trouble.
Let me explain my limited understanding of how GetObject works:
GetObject() is a two step process
1. It first looks for a running instance that was identified by the strPath. If it finds that running instance then it sets a reference to it.
2. If the first step fails to see the instance as running then it attempts to retrieve's the file and open it on the computer that made the call.
How I have explained steps 1 and 2 is exactly the behavior that I am witnessing which is certainly not what I'm looking for. Step 1 is failing and step 2 does work. Opening an other instance of an already running spreadsheet is unacceptable. I need it to work in the same manner as it did when both spreadsheets were on one computer.
To correct this let me share with you where my reading has taken me:
1.Possible NetWork issue:
I don't think so....It does retrieve the file that GetObject called. But I do wonder if I should set this up on a mapped network drive rather just thru the network.
2. Register as a running instance on the ROT(Running Object Table)
My understanding is the spreadsheet has to lose focus before it is registered. As far as knowing how to determine whether it has been registered I wouldn't have clue. In my situation this just defines the order in which things get launched in the morning. There are other applications launched so to insure Excel loses focus.
3.Launch Microsoft Excel, giving it focus:
Taken from: [url]
Shell "C:Program FilesMicrosoft OfficeOfficeExcel.EXE", _
vbMinimizedFocus 'other options for starting with
'focus: vbMaximizedFocus and vbNormalFocus