LisHawj Posted July 11, 2017 Share Posted July 11, 2017 (edited) I have an excel file stored on a SharePoint (networked) site that requires "checking" out the file to enable write. I wrote a small script to open the target file, activate a sheet, and automatically populate cells from an array. The script work fine if the target file is stored locally on the PC, but the script returns Error 2 that the file path does not exist if the file is on a network drive. What is causing this? The following conditions are true: 1. The network drive containing the target Excel file exists and target name is correct. 2. The Excel file on the network drive can be accessed and opened manually outside of the script. 3. Using __Excel_Open to open an Excel instance and browsing Open from the Excel instance shows no network drives mapped. Only local drives are accessible and this is likely the root cause of the problem, but I don't understand why it can only see local drives. I speculate that line item 3 above is the cause of my problem, but I don't understand why the Excel instance can only see local drives. Thank you. #include <GUIConstantsEx.au3> #include <Array.au3> #include <Excel.au3> #include <File.au3> Global $oExcel Global $sWorkbook = "Y:\Pricing_catalog.xlsx" ;Let's open the Excel spreadsheet. Global $oExcel = _Excel_Open() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Update monthly spreadsheet", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook) If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "Update monthly spreadsheet", "Error - $oExcel is not an object or not an application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) Exit ElseIf @error = 2 Then MsgBox($MB_SYSTEMMODAL, "Update monthly spreadsheet", "Error - The specified file path does not exist." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) Exit ElseIf @error = 3 Then MsgBox($MB_SYSTEMMODAL, "Update monthly spreadsheet", "Error - Unable to open the file path." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) Exit EndIf Edited July 11, 2017 by LisHawj Link to comment Share on other sites More sharing options...
water Posted July 11, 2017 Share Posted July 11, 2017 IIRC we already had a similar issue regarding Sharepoint some time ago. I'm on a business trip right now so I can't check. Will do so after my return. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
LisHawj Posted July 13, 2017 Author Share Posted July 13, 2017 Thanks you, Water. I look forward to hearing and learning more about this issue regarding Sharepoint. Link to comment Share on other sites More sharing options...
water Posted July 13, 2017 Share Posted July 13, 2017 The discussion about accessing SharePoint starts here: Seems you need a different approach. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now