Linker IT Software
Google
Web www.oraxcel.com
menubar-top-links menubar-top-rechts
Home Help Search Login
Welcome, Guest. Please Login.
SQL*XL: Database to Excel bridge litLIB: Excel power functions pack ExcelLock: Locking and securing your valuable Excel spreadsheets encOffice: Protect your Excel file easy and safe encOffice: Protect your Excel file easy and safe
Pages: 1
Error 91: SQLXL.Database.ConnectionType = litOO4O (Read 3648 times)
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
Error 91: SQLXL.Database.ConnectionType = litOO4O
09.10.07 at 09:47:30
 
Error 91: SQLXL.Database.ConnectionType = litOO4O
 
I am getting the error 91 on the first line (SQLXL.Database.ConnectionType) in the macro below:
Run-time error 91: Object variable or with block variable not set
 
Code:
Sub macro1
 SQLXL.Database.ConnectionType = litOO4O
 SQLXL.Database.Connect UserName:="scott", Password:="tiger", DBAlias:="ora817"
End Sub

 
Edited:
Please note that in SQL*XL 5.2 the syntax changed. The connectiontype property has become read only and instead it is passed as a parameter to the connect function. See:
http://www.oraxcel.com/projects/sqlxl/help/vba/SQLXL/Database/index.html

 
This error occurs when the Database object in SQLXL is not initialised. I found that when an error is encountered in a macro - for example due to a coding error - the SQL*XL software is also reset. Excel resets macros when a fault is encountered and SQL*XL is also reset in that case.
 
The solution is rather simpel. Just add the initialise statement just before you do any work with the SQLXL object. Your macro code becomes:
 
Sub macro1
 SQLXL.InitialiseSQLXL
 SQLXL.Database.ConnectionType = litOO4O
 SQLXL.Database.Connect UserName:="scott", Password:="tiger", DBAlias:="ora817"
End Sub

 
Some users reported an additional error 440 when hitting a macro coding error in their own macros. This problem has been fixed in version 4.2.4.
 
See also:
Runtime error 91  
http://www.oraxcel.com/cgi-bin/yabb2/YaBB.pl?num=1134121573
Back to top
 
« Last Edit: 30.07.14 at 13:40:14 by Gerrit-Jan Linker »  

Gerrit-Jan Linker
Linker IT Software
Email WWW Gerrit-Jan Linker   IP Logged
Pages: 1