Excel Error # 1004 was generated by Microsoft office Excel

Joined
Jul 21, 2008
Messages
1
Reaction score
0
I tried to disect the visual basic code in the macro. I think it is trying to fail in this section (code given below). We are using informix database and informix ODBC connection to connect to database.

Note :- following O.S with office combination works okay with
a) Windows X.P 2002 O.S with Office Excel 2002 SP3.
b) Windows X.P 2002 SP2 O.S with Office [color=blue! important][color=blue! important]Excel [color=blue! important]2003[/color][/color][/color].

But it doesnt work with following O.S with office combination.
a) Windows X.P 2003 SP1 with office Excel 2002 SP2.


Following is the section of the code I think 80% it is erroring out :-
Code:
With wksTemplate.QueryTables(1) .Connection = "ODBC;DSN=claim"' .Connection = cnctStr .CommandType = xlCmdSql .CommandText = cmd .Destination = Range("A5") .AdjustColumnWidth = False .BackgroundQuery = False .EnableEditing = False .EnableRefresh = True .FieldNames = False .FillAdjacentFormulas = True .PreserveColumnInfo = True .PreserveFormatting = True .RefreshOnFileOpen = False .RefreshStyle = xlInsertDeleteCells .RowNumbers = False .SavePassword = True .SaveData = True .RefreshPeriod = 0 .Refresh BackgroundQuery:=False If .Refreshing Then MsgBox "Query is currently refreshing: please wait" Else .Refresh BackgroundQuery:=False End If​


The problem is this macro was created in old version of office and not running on latest version of office. When I try to click on to help when it pops out error. I see following list of things it is asking me to check in macro error

There is an error in the macro you were running. The specified method can't be used on the specified object for one of the following reasons:
a) An argument contains a value that is not valid
b) The method can't be used in the applied context. Specifically, some Range object methods require that the range contain data. If the range does not contain data, the method fails
c) An external error occured, such as a failure to read or write from a file.
 
Nice of you to keep the link for the excel forum!
So no one has come back to you on it yet & you have come to us for help, thats nice of you!!

Oh and it's above what i got taught on ECDL, but someone may help if you can wait a while!;)
 
Back
Top