Jump to content

Recommended Posts

Posted (edited)

[UPDATE: PROBLEM SOLVED, WORKS NOW WITHOUT CHANGES]

Hello, I have this code:

;Local $var = "C:\Users\q\Downloads\tshirts\Daten.xlsx" ; lokal auf Rechner
Local $var = "\\fritz.box\FRITZ.NAS\ESD_USB\tshirts\Daten.xlsx" ; über USB-Stick an FritzBOX

Local $oWorkbook = _Excel_BookOpen($oExcel_1,$var)

With the commented local path all worked well.

But with my network path I get this error:

"C:\Program Files (x86)\AutoIt3\Include\Excel.au3" (233) : ==> The requested action with this object has failed.:
Local $oWindow = $oExcel.Windows($oWorkbook.Name)
Local $oWindow = $oExcel.Windows($oWorkbook^ ERROR
->11:59:07 AutoIt3.exe ended.rc:1
+>11:59:07 AutoIt3Wrapper Finished.
>Exit code: 1    Time: 1.772

My OS is Windows 10. If I enter \\fritz.box\FRITZ.NAS\ESD_USB\tshirts\Daten.xlsx in the Windows explorer Excel is opened with this file, so the file path is right.

So why can't I open the file in the network with _Excel_BookOpen? And what have I to do to do it?

Edited by AI123
Posted

Which version of AutoIt do you run?

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

 

Posted (edited)

After a lot of restarts now it works without changes. I don't know why, but problem seems to be solved.

Edited by AI123
Posted

👍

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

 

Posted

I've seen this before with AutoIt scripts... but not with _Excel_BookOpen. I recently found that you can map a network drive easily and temporarily while your script is running, which seems to solve my issues with network files.

Func DoStuffWithNetworkDrive($sNetworkPath)
    
    ; Map the drive to any drive letter this function then returns the letter
    Local $sDrive = DriveMapAdd($sNetworkPath, "*")
    If @error Then Exit MsgBox(0, "Network Drive", "Failed to map the network drive, check that it's connected")
    
    ; Do your stuff here
    
    DriveMapDelete($sDrive)
    
EndFunc

The other thing to note (and may not be valid for non-http or https paths) is that you should make sure that the network location (the root folder) is in your "Trusted Sites" in internet explorer. (Open IE, click Settings, Internet Options, switch to the Security tab, select Trusted Sites, click Sites button, then finally add the address)

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...