searchresult Posted April 20, 2012 Share Posted April 20, 2012 Hello, I have some problems with opening a excel book and can't find solution... Here is the code: Func G_Indeks($FileName) If $FileName == "" Then MsgBox(64, "Upozorenje", "Odaberite upisnik za indeksiranje.") Else ;~ provjera da li postoji indeks za odabranu godinu $FileName = "I-"&StringRight($FileName,4) $FilePath = "indeks\"&$FileName&".xls" $FileNameUP = "K-"&StringRight($FileName,4) $FilePathUP = "db_upisnik\"&$FileName&".xls" If FileExists($FilePath) Then ;~ Provjeriti da li je ažuran indeks odabrane godine, ako nije onda ga ažurirati MsgBox(0,"","Indeks je ažuriran") Else ;~ Kreirati indeks za odabranu godinu iz template direktorija i napuniti ga podacima ;~ Kreiranje indeks datoteke FileCopy("template\indeks.xls", "indeks\") FileMove("indeks\indeks.xls", "indeks\"&$FileName&".xls") ;~ Otvaranje datoteke i generiranje podataka Local $oExcelUP = _ExcelBookOpen($FilePathUP) Local $oExcel = _ExcelBookOpen($FilePath) EndIf EndIf EndFunc Excel is 2002 and win xp error that i get is >Running:(3.3.8.1):D:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Korisnik\Desktop\K-upisnik\WIP\K-upisnik.au3" D:\Program Files\AutoIt3\Include\Excel.au3 (191) : ==> The requested action with this object has failed.: If $sPassword = "" And $sWritePassword = "" Then .WorkBooks.Open($sFilePath, Default, $fReadOnly) If $sPassword = "" And $sWritePassword = "" Then .WorkBooks.Open($sFilePath, Default, $fReadOnly)^ ERROR ->11:42:29 AutoIT3.exe ended.rc:1 >Exit code: 1 Time: 5.836 Link to comment Share on other sites More sharing options...
water Posted April 20, 2012 Share Posted April 20, 2012 Do you get the error with _ExcelBookOpen($FilePathUP) or _ExcelBookOpen($FilePath)? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
searchresult Posted April 20, 2012 Author Share Posted April 20, 2012 With _ExcelBookOpen($FilePath) Link to comment Share on other sites More sharing options...
water Posted April 20, 2012 Share Posted April 20, 2012 I think you have to specify the absolute path (C:directoryfilename.xls), the UDF has problems with relative paths (filename.xls) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
searchresult Posted April 20, 2012 Author Share Posted April 20, 2012 Thank you... Here are the changes I made and it's working like a charm. $FileNameI = "I-"&StringRight($FileName,4) $FilePathI = @ScriptDir&"indeks"&$FileNameI&".xls" $FileNameUP = "K-"&StringRight($FileName,4) $FilePathUP = @ScriptDir&"db_upisnik"&$FileNameUP&".xls" Link to comment Share on other sites More sharing options...
water Posted April 20, 2012 Share Posted April 20, 2012 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - 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