GetObject from a web file

louisH

Board Regular
Joined
Mar 14, 2018
Messages
152
Hello,

I have a Macro launched automatically every x minutes that refreshes a couple workbooks stored on a SharePoint site.
It opens every workbook in a new Excel Instance (not simultaneously) via the Shell function, so that if one instancefails (for example an error message popping), the other ones can proceed.

My problem is that I want to communicate with these instances (Ultimately know if the wb is already running)

I found the "GetObject" function,which works fine for a file stored on a regular network :

Code:
[FONT=Arial][SIZE=3][COLOR=#000000]Set xlApp =GetObject("C:\Folderx\Workbook.xlsx").Application[/COLOR][/SIZE][/FONT]
[FONT=Arial][SIZE=3][COLOR=#000000]'If Workbook.xlsx is opened in an otherexcel Instance, xlApp contains this other instance[/COLOR][/SIZE][/FONT]
[FONT=Arial][SIZE=3][COLOR=#000000]'If not, throws an error (great)[/COLOR][/SIZE][/FONT]

However, for the SharePoint files,GetObject doesn't seem to accept web urls...
I tried with :

Code:
[FONT=Arial][SIZE=3][COLOR=#000000]Set xlApp =GetObject("http://sharepoint.xx.xx/libraryx/folderx/Workbook.xlsx").Application[/COLOR][/SIZE][/FONT]
[FONT=Arial][SIZE=3][COLOR=#000000]'throws an error even if the file is opened[/COLOR][/SIZE][/FONT]

[FONT=Arial][SIZE=3][COLOR=#000000]Set xlApp =GetObject("//sharepoint.xx.xx/libraryx/folderx/Workbook.xlsx").Application[/COLOR][/SIZE][/FONT]
[FONT=Arial][SIZE=3][COLOR=#000000]'Opens the workbook in the current Instance then immediatly closes it[/COLOR][/SIZE][/FONT]

I know there is some solutions usingWindows library functions to reach other instances but I don't understand them and I would prefer using Excel's standard ways
I'm still opened to any other solution...

Thanks for your time.
 
Last edited:

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Put simply what you want to do isn't possible, one cannot use GetObject with a url.

Typically, the way one does this through sharepoint is to map the drive, you then have a unc file path which you can user with GetObject, rahter than a url
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,314
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top