PC Review


Reply
Thread Tools Rate Thread

Control button display issue

 
 
Mike
Guest
Posts: n/a
 
      24th Jul 2008
I am adding buttons with the following code. They are active and
function but do not display. If I set them manually to "Text Only
(Always)" via the customize menu screen, they display fine. I'm using
XL2003.

I am at my wit's end trying to do this programmatically. What am I
missing? Thanks.

.Controls.Add Type:=msoControlButton, ID:=2949, Before:=2
With .Controls(1)
.Visible = True
.Caption = "ReadFile"
.OnAction = "thisworkbook.readfile"
End With
 
Reply With Quote
 
 
 
 
Internetdomainowner@hotmail.com
Guest
Posts: n/a
 
      25th Jul 2008
On Jul 24, 6:38*pm, Mike <mirraha...@mailexpire.com> wrote:
> I am adding buttons with the following code. They are active and
> function but do not display. If I set them manually to "Text Only
> (Always)" *via the customize menu screen, they display fine. I'm using
> XL2003.
>
> I am at my wit's end trying to do this programmatically. What am I
> missing? Thanks.
>
> * * * * .Controls.Add Type:=msoControlButton, ID:=2949, Before:=2
> * * * * With .Controls(1)
> * * * * * * * * .Visible = True
> * * * * * * * * .Caption = "ReadFile"
> * * * * * * * * .OnAction = "thisworkbook.readfile"
> * * * * End With


I don't get why you want to create buttons through code...

Try something like

Private Sub UserForm_Activate()
UserForm1.Commandbutton2.Visible = False
End Sub

Private Sub CommandButton1_Click()
If UserForm1.Commandbutton2.Visible = False Then
UserForm1.CommandButton2.Visible = True
End If

If UserForm1.Commandbutton2.Visible = True Then
UserForm1.CommandButton2.Visible = False
End If

End Sub

Hope that helps -- I've built a lot of complex programs and have never
had the need to have code create buttons... Your best bet is going
through .visible =
 
Reply With Quote
 
news.microsoft.com
Guest
Posts: n/a
 
      25th Jul 2008
After your response, I realized that I forgot to mention a crucial detail:
The buttons are toolbar buttons.



 
Reply With Quote
 
Mike
Guest
Posts: n/a
 
      28th Jul 2008
Solution was to add the following to each control button.

..Style = msoButtonCaption


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
button control issue craymer Microsoft Access 1 25th Feb 2009 03:22 PM
ajax control toolkit AccordianPane display issue bdarcey@gmail.com Microsoft ASP .NET 0 13th Mar 2008 04:13 PM
Derived Button Control Subclass Issue gregarican Microsoft C# .NET 5 6th Jun 2007 06:59 PM
Login control second button issue John Microsoft ASP .NET 0 11th Dec 2005 07:55 AM
Calendar Control - Display Issue AG Microsoft Excel Programming 0 10th Nov 2004 08:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:29 AM.