BlueCougsnHam
New Member
- Joined
- Oct 26, 2019
- Messages
- 1
I have an excel file (File #1 ) in which I would like the VBA code to open a file which is saved on my OneDrive (File #2 ). This excel file (File #1 ) many people will use, so when the VBA code runs I want it to be able to access my OneDrive file (File #2 ) and open it in the background within Excel. With the file stored in OneDrive (File #2 ) I have created a shared link (see below) which should allow anyone with the link to open the file. With this link anyone should be able to access the file.
Link: https://1drv.ms/x/s!AmdCer05hKV4geAnbDaOSX9UrTfLHQ?e=5Pm7dL
I have not been able to find a way to open this file (File #2 ) via VBA code which is in the first file (File #1 ). I want it to open in Excel, not Excel on-line. If I can get it (File #2 ) to open it will then allow me to pull data from it and put it into the File #1 .
So I added this code<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-style: inherit; font-variant-caps: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">
Set wb = Workbooks.Open("https://1drv.ms/x/s!AmdCer05hKV4geAnbDaOSX9UrTfLHQ?e=5Pm7dL")
</code>
When this line of code runs, Excel shuts down. A window opens stating Microsoft Error Reporting. It then says "There was a problem with Microsoft Excel and we apologize for the inconvenience. Microsoft Excel will attempt to recover your work, but recent changes might be lost."
Link: https://1drv.ms/x/s!AmdCer05hKV4geAnbDaOSX9UrTfLHQ?e=5Pm7dL
I have not been able to find a way to open this file (File #2 ) via VBA code which is in the first file (File #1 ). I want it to open in Excel, not Excel on-line. If I can get it (File #2 ) to open it will then allow me to pull data from it and put it into the File #1 .
So I added this code<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-style: inherit; font-variant-caps: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">
Set wb = Workbooks.Open("https://1drv.ms/x/s!AmdCer05hKV4geAnbDaOSX9UrTfLHQ?e=5Pm7dL")
</code>
When this line of code runs, Excel shuts down. A window opens stating Microsoft Error Reporting. It then says "There was a problem with Microsoft Excel and we apologize for the inconvenience. Microsoft Excel will attempt to recover your work, but recent changes might be lost."
Last edited by a moderator: