![]()  | 
 
Automatically pressing of an button? | 
 
    Post Reply  
   | 
  
| Author | |
   
   finn  
   
   Groupie  
   Joined: 11 February 2005 Location: Germany Status: Offline Points: 60  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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!   | 
 |
![]()  | 
 |
   
   SuperMario  
   
   Senior Member  
    
   Joined: 14 February 2004 Status: Offline Points: 18057  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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.
    
   
   | 
 |
![]()  | 
 |
   
   finn  
   
   Groupie  
   Joined: 11 February 2005 Location: Germany Status: Offline Points: 60  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 28 June 2005 at 12:41pm | 
 
| 
   
    That's want I wanted...  I need the CommandBarControl.Execute() method! Thank you very much! Yours, Finn!   | 
 |
![]()  | 
 |
   
   finn  
   
   Groupie  
   Joined: 11 February 2005 Location: Germany Status: Offline Points: 60  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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! 
 I hope you can help me... Yours, Finn!  | 
 |
![]()  | 
 |
   
   gshawn  
   
   Senior Member  
   Joined: 04 October 2004 Status: Offline Points: 227  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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  | 
 |
![]()  | 
 |
   
   finn  
   
   Groupie  
   Joined: 11 February 2005 Location: Germany Status: Offline Points: 60  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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 hope you can help me! Yours, Finn!   | 
 |
![]()  | 
 |
   
   SuperMario  
   
   Senior Member  
    
   Joined: 14 February 2004 Status: Offline Points: 18057  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 29 June 2005 at 11:10am | 
 
| 
   
    
   Try: 
   
  Set Control = CommandBars.FindControl(, ID_VIEW_STATUSBAR,,True)  | 
 |
![]()  | 
 |
    Post Reply  
   | 
  |
|       
  
  Tweet   	
    | 
 
| Forum Jump | Forum Permissions  ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum  |