gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,347
- Office Version
- 365
- Platform
- Windows
I have code that does a bunch of things, but when it gets to the point where I am telling it to refresh these two tables. I am getting an error message. But if I break out these two lines into there own macro, they run fine (they refresh the tables without any errors) any suggestions
Run-Time error '1004':
Microsoft Excel is refreshing some data. Please try again later.
Sheets("Proposal Tasks").ListObjects(1).QueryTable.Refresh BackgroundQuery:=False
Sheets("Spread_Esc").ListObjects(1).QueryTable.Refresh BackgroundQuery:=False
Run-Time error '1004':
Microsoft Excel is refreshing some data. Please try again later.
Sheets("Proposal Tasks").ListObjects(1).QueryTable.Refresh BackgroundQuery:=False
Sheets("Spread_Esc").ListObjects(1).QueryTable.Refresh BackgroundQuery:=False
Code:
Sub Import_PP_Report()
Sheets("CMCS_PBoM").Visible = True
'Sheets("Cost Summary").Visible = True
'Sheets("Validity Summary").Visible = True
'Sheets("Cost Drivers").Visible = True
'Sheets("Part Summary").Visible = True
'Sheets("Vendor Summary").Visible = True
'Sheets("VendorPart Summary").Visible = True
RemoveTab
UserFormX.Show vbModeless
Application.ScreenUpdating = False
'**************************************************
UserFormX.LabelProg.Width = 48
UserFormX.LabelProg.Caption = "28%"
DoEvents
'**************************************************
GetCMCS
'**************************************************
UserFormX.LabelProg.Width = 101
UserFormX.LabelProg.Caption = "52%"
DoEvents
'**************************************************
MakeTable
'AddTitleFormulas
'**************************************************
UserFormX.LabelProg.Width = 150
UserFormX.LabelProg.Caption = "76%"
DoEvents
'**************************************************
Refresh_All_tables
'**************************************************
UserFormX.LabelProg.Width = 196
UserFormX.LabelProg.Caption = "99%"
DoEvents
'**************************************************
CopyPropNameToTaskList
GetProposalIDfromMtrlAdHoc
'************This is where the error happens
'Refresh table ModelPropricer_vdataNISTaskView
Sheets("Proposal Tasks").ListObjects(1).QueryTable.Refresh BackgroundQuery:=False
Sheets("Spread_Esc").ListObjects(1).QueryTable.Refresh BackgroundQuery:=False
UserFormX.Hide
Sheets("CMCS_PBoM").Select
MsgBox "The CMCS_PBoM report is built off the ProPricer Export: Material Ad Hoc."
End Sub
[Code/]
as stated the code to refresh the tables when in its own macro runs fine. It doesn't error out, but I wanted it to be done in all one step for the user.
any help is appreciated