Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Triggering an excel menu using macros

I have an excel file with a web query in it. Right now i can execute
the webquery by doing one of the following methods
chose the menu item Data- Import External Data - Edit Query
click the Edit query button in the external data tool bar.
Right click on the cell on the excel and say Edit query.

When i do any of the above excel brings up a window (which is
essentially internet explorer with title Edit Web Query) with a
predefined url in there.

I am trying to automate this process so that this window comes up
automatically. I wrote the following macro
Application.Sheets(1).Range("A3").Activate
Set cmndButton = Application.CommandBars.FindControl(Type:= _
msoControlButton, ID:="1950")
cmndButton.Visible = True
cmndButton.Execute

but it is failing with the error
err.Number : -2147467259
err.Description Method 'Execute' of object '_CommandBarButton' failed
err.HelpContext 1000440
err.Source VBAProject
err.LastDllError 0
err.HelpContext 1000440

This error happens if i click on the edit query button on the tool bar
or if i put the code in the activate event of the worksheet. But right
clickng on the cell and chosing the menu item Edit Query or chosing
menu item Data- Import External Data - Edit Query brings up the
popup window as it should be.

Any help is greatly appreciated.

Thanks

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
Triggering an action when an item is selected from a dropdown menu Xonnel1212 Excel Worksheet Functions 1 July 2nd 09 12:17 AM
Userform combo box triggering macros michaelberrier Excel Discussion (Misc queries) 6 June 10th 06 01:25 PM
triggering different macros from list box? hammer Excel Programming 9 October 14th 03 10:37 PM
Triggering click event of a menu in vba steve Excel Programming 4 August 19th 03 06:17 PM
Triggering click event of a menu in vba Tom Ogilvy Excel Programming 0 August 18th 03 07:51 PM


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

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

About Us

"It's about Microsoft Excel"