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
Object variable or With block variable not set (Read 3797 times)
Gerrit-Jan Linker
YaBB Administrator
*****




Posts: 75
Object variable or With block variable not set
18.05.09 at 20:22:53
 
Object variable or With block variable not set (Error 91)
 
Quote:
I'm having some issues with the examples,
specifically the GetData subroutine. I commented all of the lines out
in the sub below. From the top I uncommented them and ran the macro
each time. It was good until I uncommented SQLXL.Sql.setText "select
sysdate from dual"

At that point, I always receive the error:
Object variable or With block variable not set (Error 91)

Private Sub GetData()
Dim wb As Workbook
Dim ws As Worksheet

'put it into a new workbook
Set wb = Workbooks.Add
Set ws = wb.Worksheets(1)

SQLXL.Sql.setText "select sysdate from dual"
Set SQLXL.Sql.Statements(1).Target = Targets(litExcel)
Targets(litExcel).StartFromCell = "A1"
SQLXL.Sql.Statements(1).Execute
End Sub

 
Please realise that after an error sqlxl is not initialised anymore. This is an Excel peculiarity. Just add in the first line of your application;
Sqlxl.initialisesqlxl
Back to top
 
 

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