Can I write a Macro to open From Web

TedX

Board Regular
Joined
Apr 18, 2021
Messages
122
Office Version
  1. 365
Platform
  1. Windows
Just a quick question, What would be the VBA for writing a simple macro that opens Data/From Web
I'm just after the empty dialogue box to open, that's all. TIA 🙏

zzzzz484.jpg
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi. The following should work:

VBA Code:
Sub DisplayGetDataFromWeb()
    Application.CommandBars.ExecuteMso "GetPowerQueryDataFromWeb"
End Sub

Is that what you were after?
 
Upvote 0
Solution
Hi. The following should work:

VBA Code:
Sub DisplayGetDataFromWeb()
    Application.CommandBars.ExecuteMso "GetPowerQueryDataFromWeb"
End Sub

Is that what you were after?

Absolutely Dan_W, that is EXACTLY what I wanted and now that I can see the code, I will look into the other CommanBars, thank you very much, you were so helpful. 🙏
 
Upvote 0
You're welcome. A handy way of working out what code to use for certain commands is to go to customize the QAT and hover the mouse cursor over any given menu option amongst the available commands. The code to to use will appear in a tooltip in parentheses. It's difficult to explain, but I'm not in front of my computer at the moment.
 
Upvote 0
Further to my reply above, I thought it might be easier to understand with a screen capture. As you can see in the image below, the phrase you are looking for is the one at the end in brackets - In this case, the command I'm hovering over will be FormatCellsDialog
So that will just be:
VBA Code:
Application.CommandBars.ExecuteMso "FormatCellsDialog"
Hope that's useful.

1669853074390.png
 
Upvote 0
Further to my reply above, I thought it might be easier to understand with a screen capture. As you can see in the image below, the phrase you are looking for is the one at the end in brackets - In this case, the command I'm hovering over will be FormatCellsDialog
So that will just be:
VBA Code:
Application.CommandBars.ExecuteMso "FormatCellsDialog"
Hope that's useful.

View attachment 79950
Absolutely useful Dan_W, thank you for going the extra mile 🙏 🙏 🙏
 
Upvote 0
You're very welcome. Thank you for the kind feedback. :-)
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

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
Back
Top