Problem with simple macro... Error 400

korcutt

New Member
Joined
Nov 14, 2005
Messages
3
Howdy All,
I'm trying to update/refreash the data in the worksheet by using the following code... If I "click" the "Cancel" button on the file dialog I get the wonderful error 400 with nothing else explained!

Here's the code:

Public Sub RefreshData()
Selection.QueryTable.Refresh
End Sub


Any ideas out there?????

Thanks in advance,

Kevin Orcutt
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

sweater_vests_rock

Well-known Member
Joined
Oct 8, 2004
Messages
1,657
korcutt.

i guess i'm confused. what file dialog are you getting? i've got a web query and i used your code to update without trouble...and without dialog box.

thanks. ben.

ps. welcome to the board!!!
 
Upvote 0

Zack Barresse

MrExcel MVP
Joined
Dec 9, 2003
Messages
10,881
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
  3. Web
Hello korcutt, welcome to the board!

You could always put an On Error Resume Next in your code above the offending line. Note that this is a fairly drastic measure as Excel will ignore all errors associated with your code. Generally, it's accepted practice to use some type of Error handler. If there is only one line, in this case, you don't really need something too elaborate.

If there are other actions you'd like to perform if there is an error, that can be done as well.

Is this what you are looking for?
 
Upvote 0

Forum statistics

Threads
1,195,644
Messages
6,010,896
Members
441,571
Latest member
stolenweasel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top