Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Automatically pressing of an button?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Automatically pressing of an button?

 Post Reply Post Reply
Author
Message
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Topic: Automatically pressing of an button?
    Posted: 27 June 2005 at 4:52am

Hello!

I want to press automatically a button (the ID is "ID_BUTTON") in my CommandBar when the user press my CommandButton (name is "cmdAuto")...

I'm sorry for my bad English but I'm from Germany and I don't know how to say some things...

Yours,

Finn!

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 28 June 2005 at 10:17am
You can use the CommandBarControl.Execute() method to execute a command.  If you want the button to look "pressed" then you must use the CommandBarControl.Checked property.
Back to Top
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Posted: 28 June 2005 at 12:41pm

That's want I wanted...

I need the CommandBarControl.Execute() method! Thank you very much!

Yours,

Finn!

Back to Top
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Posted: 28 June 2005 at 12:48pm

One question... When I type this vb-code (I use VB 6.0 Enterprise Edition on Windows XP), I get the run-time error 91: object variable or with block variable not set!

CommandBars.FindControl(, ID_VIEW_STATUSBAR).Execute

I hope you can help me...

Yours,

Finn!

Back to Top
gshawn View Drop Down
Senior Member
Senior Member


Joined: 04 October 2004
Status: Offline
Points: 227
Post Options Post Options   Thanks (0) Thanks(0)   Quote gshawn Quote  Post ReplyReply Direct Link To This Post Posted: 28 June 2005 at 1:19pm

CommandBars.FindControl(, ID_VIEW_STATUSBAR) probably returned Nothing... You'll always want to account for that scenario when using .FindControl.

Try

Dim Control As CommandBarControl
Set Control = CommandBars.FindControl(, ID_VIEW_STATUSBAR)
If Not Control Is Nothing Then Control.Execute

Back to Top
finn View Drop Down
Groupie
Groupie
Avatar

Joined: 11 February 2005
Location: Germany
Status: Offline
Points: 60
Post Options Post Options   Thanks (0) Thanks(0)   Quote finn Quote  Post ReplyReply Direct Link To This Post Posted: 29 June 2005 at 6:11am

Yes that's right! CommandBars.FindControl(...) returns Nothing. When I use your method it works very well, but I need the Execute method always! Some more information:

  • I use VB 6.0 of Visual Studio 6.0 Enterprise Edition
  • My system is Windows XP Home Edition SP2
  • I have version 9.51 of the Xtreme Suite Pro ActiveX

I hope you can help me!

Yours,

Finn!

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 29 June 2005 at 11:10am
Try:
Set Control = CommandBars.FindControl(, ID_VIEW_STATUSBAR,,True)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.188 seconds.