Print Page | Close Window

Automatically pressing of an button?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=2462
Printed Date: 07 July 2024 at 7:28pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Automatically pressing of an button?
Posted By: finn
Subject: Automatically pressing of an button?
Date 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!




Replies:
Posted By: SuperMario
Date 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.


Posted By: finn
Date Posted: 28 June 2005 at 12:41pm

That's want I wanted...

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

Yours,

Finn!



Posted By: finn
Date 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!



Posted By: gshawn
Date 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



Posted By: finn
Date 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!



Posted By: SuperMario
Date Posted: 29 June 2005 at 11:10am
Try:
Set Control = CommandBars.FindControl(, ID_VIEW_STATUSBAR,,True)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net