Workbooks.Open from OneDrive pops Microsoft sign-in dialog

Celly

Board Regular
Joined
Jan 29, 2015
Messages
84
Office Version
  1. 2016
Platform
  1. Windows
This is annoying, I have a local copy of a spreadsheet which has a VBA script to import data from an xlsm on a OneDrive directory. Even though OneDrive is already running and logged in, the Workbooks.Open line will result in a Microsoft sign-in dialog popping up (Type the email of the account you would like to use to open...). If I simply close the dialog without logging in, the VBA script opens and imports the data successfully. I tried setting the ReadOnly parameter to true, however this doesn't fix it. Any ideas?

EDIT: This also seems to be new behavior in Excel 2016 that didn't occur with Excel 2010
 
Last edited:

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
I don't use onedrive. So, I can't test the method I'm going to recommend. The following code is used to turn off warning. It may work for you.

Code:
Application.DisplayAlerts = [COLOR=#000080]False
...your code here......
Application.DisplayAlerts = [COLOR=#000080]True[/COLOR][/COLOR]
 
Upvote 0
If you know the exact window title/caption of the Microsoft sign-in dialog popup then you could run an OnTime or a windows timer routine just before it is shown .. The timed routine will then retrieve the popup Window handle and send a WM_ClOSE message to it.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,592
Members
449,089
Latest member
Motoracer88

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