Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Runtime Error .Refresh
I have the folloing code it worked fine up till today and now it gives me a
Runtime Error and when I debug it goes to the .Refresh BackgroundQuery: = False line of the following code. Sub Update() Dim stAppName As String stAppName = "H:\common\count\Update.bat" Call Shell(stAppName, 1) Sheets("Master").Visible = True Sheets("Master").Select Range("A1:AK5000").Select Selection.ClearContents Range("A1").Select With ActiveSheet.QueryTables.Add(Connection:= _ "ODBC;DSN=dBASE Files;DefaultDir=H:\common\count;DriverId=533;MaxB ufferSize=2048;PageTimeout=5;" _ , Destination:=Range("A1")) .CommandText = Array( _ "SELECT INMTINFO.IN_INMNUM, INMTINFO.IN_NAME, INMTINFO.IN_RACE, INMTINFO.IN_CSLR, INMTINFO.IN_CUSLVL, INMTINFO.IN_STATUS, INMTINFO.IN_BIRTHDT, INMTINFO.IN_RELIGIO, INMTINFO.IN_FACRCVD, INMTINFO.IN_DOCR" _ , _ "CVD, INMTINFO.IN_RCVDFAC, INMTINFO.IN_EFFDATE, INMTINFO.IN_SNTCLAS, INMTINFO.IN_MINDATE, INMTINFO.IN_MAXDATE, INMTINFO.IN_MINSNT, INMTINFO.IN_MAXSNT, INMTINFO.IN_CMTCNTY, INMTINFO.IN_OFFENSE, INMTINFO" _ , _ ".IN_PERMLOC, INMTINFO.IN_LOCDESC, INMTINFO.IN_BLDING, INMTINFO.IN_SECTION, INMTINFO.IN_CELLDRM, INMTINFO.IN_BEDNUM, INMTINFO.IN_HONOR, INMTINFO.IN_PRIMPGP, INMTINFO.IN_WA1, INMTINFO.IN_WA1STRT, INMTIN" _ , _ "FO.IN_WA1CS, INMTINFO.IN_MEDSTR, INMTINFO.IN_MEDEND, INMTINFO.IN_CRESSTR, INMTINFO.IN_CRESEND, INMTINFO.IN_DAOFF, INMTINFO.IN_SEXOFF, INMTINFO.IN_CNAME" & Chr(13) & "" & Chr(10) & "FROM INMTINFO INMTINFO" _ ) .Name = "Query from dBASE Files" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = True .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .PreserveColumnInfo = True .Refresh BackgroundQuery:=False End With |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Runtime Error .Refresh
Well, to begin with, you are setting the Background query to both TRUE and
FALSE. .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True<-----------------------here .RefreshStyle = xlInsertDeleteCells .SavePassword = True .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .PreserveColumnInfo = True .Refresh BackgroundQuery:=False <----------------and here Set either the .Backgroundquery property to TRUE or FALSE or , on the ..Refresh just add TRUE or FALSE - .Refresh False. "Michelle" wrote: I have the folloing code it worked fine up till today and now it gives me a Runtime Error and when I debug it goes to the .Refresh BackgroundQuery: = False line of the following code. Sub Update() Dim stAppName As String stAppName = "H:\common\count\Update.bat" Call Shell(stAppName, 1) Sheets("Master").Visible = True Sheets("Master").Select Range("A1:AK5000").Select Selection.ClearContents Range("A1").Select With ActiveSheet.QueryTables.Add(Connection:= _ "ODBC;DSN=dBASE Files;DefaultDir=H:\common\count;DriverId=533;MaxB ufferSize=2048;PageTimeout=5;" _ , Destination:=Range("A1")) .CommandText = Array( _ "SELECT INMTINFO.IN_INMNUM, INMTINFO.IN_NAME, INMTINFO.IN_RACE, INMTINFO.IN_CSLR, INMTINFO.IN_CUSLVL, INMTINFO.IN_STATUS, INMTINFO.IN_BIRTHDT, INMTINFO.IN_RELIGIO, INMTINFO.IN_FACRCVD, INMTINFO.IN_DOCR" _ , _ "CVD, INMTINFO.IN_RCVDFAC, INMTINFO.IN_EFFDATE, INMTINFO.IN_SNTCLAS, INMTINFO.IN_MINDATE, INMTINFO.IN_MAXDATE, INMTINFO.IN_MINSNT, INMTINFO.IN_MAXSNT, INMTINFO.IN_CMTCNTY, INMTINFO.IN_OFFENSE, INMTINFO" _ , _ ".IN_PERMLOC, INMTINFO.IN_LOCDESC, INMTINFO.IN_BLDING, INMTINFO.IN_SECTION, INMTINFO.IN_CELLDRM, INMTINFO.IN_BEDNUM, INMTINFO.IN_HONOR, INMTINFO.IN_PRIMPGP, INMTINFO.IN_WA1, INMTINFO.IN_WA1STRT, INMTIN" _ , _ "FO.IN_WA1CS, INMTINFO.IN_MEDSTR, INMTINFO.IN_MEDEND, INMTINFO.IN_CRESSTR, INMTINFO.IN_CRESEND, INMTINFO.IN_DAOFF, INMTINFO.IN_SEXOFF, INMTINFO.IN_CNAME" & Chr(13) & "" & Chr(10) & "FROM INMTINFO INMTINFO" _ ) .Name = "Query from dBASE Files" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = True .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .PreserveColumnInfo = True .Refresh BackgroundQuery:=False End With |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
xpath error? Runtime Error 13 type mismatch | Excel Discussion (Misc queries) | |||
Runtime error '1004' General ODBC error | New Users to Excel | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) | |||
Interior class error/runtime error 1004 | Excel Programming | |||
Syntax Error Runtime Error '424' Object Required | Excel Programming |