Workbooks.Open from OneDrive pops Microsoft sign-in dialog

Celly

Board Regular
Joined
Jan 29, 2015
Messages
81
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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,872
Office Version
  1. 2010
Platform
  1. Windows
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]
 

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
8,203
Office Version
  1. 2016
Platform
  1. Windows
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:

Watch MrExcel Video

Forum statistics

Threads
1,130,112
Messages
5,640,173
Members
417,129
Latest member
geekzilla

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
Top