Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default run-time error 1004

Hoping someone can help me out. I have no knowledge of VB so this is
all greek to me. Below is one of seven macro that runs to a report that
is integrated into a CRM database (salesfoece.com). I get this error
when I try to run the macro that refreshes the data being pulled from
salesforce.com into the report. I get the error message "run-time error
1004" and it highlights the following text in
yellow....Selection.QueryTable.Refresh BackgroundQuery:=False
right above this text...

' Refresh Data
Sheets("Raw Data").Select
Range("AI28").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Range("BH33").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("Reference").Select
Range("B26").Select

QUESTIONs:
What does "Selection.QueryTable.Refresh BackgroundQuery:=False" mean?
What does Range(BH33) mean?
How might I fix this busted macro?

thanks in advance for your help
p


COMPLETE VB SCRIPT FROM BUSTED MACRO

Sub Sort_Refresh()
'
' SOrt_Refresh Macro
' Macro recorded 11/10/2005 by tchan
'


' Clear Top 100, Raw Data sheets
Sheets("TOP 100").Select
Cells.Select
Selection.ClearContents
Sheets("Raw Data").Select
Columns("A:Y").Select
Range("Y1").Activate
Selection.ClearContents

' Refresh Data
Sheets("Raw Data").Select
Range("AI28").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Range("BH33").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Sheets("Reference").Select
Range("B26").Select
Selection.QueryTable.Refresh BackgroundQuery:=False

' Sort to determine duplicates
Sheets("Raw Data").Select
Columns("BA:BP").Select
Range("BP1").Activate
Selection.Sort Key1:=Range("BA2"), Order1:=xlDescending,
Key2:=Range( _
"BB2"), Order2:=xlDescending, Header:=xlGuess, OrderCustom:=1,
MatchCase _
:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
_
DataOption2:=xlSortNormal
Columns("AA:AP").Select
Range("AP1").Activate
Selection.Sort Key1:=Range("AA2"), Order1:=xlDescending,
Key2:=Range( _
"AB2"), Order2:=xlDescending, Header:=xlGuess, OrderCustom:=1,
MatchCase _
:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
_
DataOption2:=xlSortNormal

' Replace Enterprise Based Support with EBS
Columns("BE:BE").Select
Selection.Replace What:="Enterprise Based Support",
Replacement:="EBS", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:= _
False, ReplaceFormat:=False

' Time Stamp
Sheets("Reference").Select
Range("H3").Select
Selection.COPY
Sheets("Instructions").Select
Range("I6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.NumberFormat = "[$-409]m/d/yy h:mm AM/PM;@"

'Ready Message
If Application.Ready = True Then
MsgBox "Application is ready."
Else
MsgBox "Application is not ready."
End If

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default run-time error 1004

QUESTIONs:
What does "Selection.QueryTable.Refresh BackgroundQuery:=False" mean?


it causes previously set querytable (within "Raw Data" sheet) to refresh
(connection to database based on query definition, retrieving data )

What does Range(BH33) mean?


the place in sheet "Raw Data" where querytable begins

How might I fix this busted macro?



IMHO macro is not a problem in this case - maybe you cleared contents (part
of sheet area) of "Raw Data" manually so querytable is not existing anymore
in indicated range "BH33" or maybe conection ( or database statement ) to
particular database fails.
If you have a copy of this file - check it out - maybe it will work.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run-time error 1004 - General ODBC Error Linda Excel Programming 0 July 5th 06 04:32 PM
Run time error 1004, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM
run-time error '1004': Application-defined or object-deifined error [email protected] Excel Programming 5 August 10th 05 09:39 PM
Run time error '1004': Generaol ODBC error Dwaine Horton[_3_] Excel Programming 2 April 26th 05 02:52 PM
Run time error 1004 General ODCB Error Kevin Excel Programming 3 February 26th 05 12:51 PM


All times are GMT +1. The time now is 06:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"