Sign in to follow this  
Followers 0
searchresult

Excel problem

6 posts in this topic

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

Share this post


Link to post
Share on other sites



Do you get the error with _ExcelBookOpen($FilePathUP) or _ExcelBookOpen($FilePath)?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

With _ExcelBookOpen($FilePath)

Share this post


Link to post
Share on other sites

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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"

Share this post


Link to post
Share on other sites
;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0