View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Command Button in Excel

I think that's the way many learn. It's the way I did, er, do.



STEVE BELL wrote:

Dave,

Yes! Thank you!

My purpose is just a simplified means of visually spacing the button names
without adding code.

You may have noticed that my code is usually very basic and does not contain
the more in-depth techniques to improve it... In many way I am not much
more than a novice with some success at building relatively complex code.
Slowly the lessons learned on this ng are starting to sink in and I am
starting to mature... (My biggest problem is trying to remember all this
stuff - fortunately I use google search Thanks to Ron, and have build a
massive workbook with code from this ng.)

[Looks like I am going overboard - but I owe so much to this ng]. I changed
careers and my life when I started getting serious about Excel and this ng
helped me learn VBE...

I can never thank everyone enough...

--
steveB

Remove "AYN" from email to respond
"Dave Peterson" wrote in message
...
And you do know that you could add a separator between icons on that
toolbar.
Look at that .begingroup property.



STEVE BELL wrote:

Dave,

You are one of the best! You have taught me much (along with the other
guru's on this ng).

Your critiques are important to me - keep me straight!

It you say it - than it is important to do it!

Of course I still have some of my own preferences - but again your
suggestions MUST be taken
seriously by me...

Thanks for everything you have done for me and others over the years...

--
steveB

Remove "AYN" from email to respond
"Dave Peterson" wrote in message
...
You don't have to remove the spaces on my account <bg. But I know
that
it
would confuse me!



STEVE BELL wrote:

Dave,

Appreciate your concern.

I do like leading and trailing spaces for the text in a button.
Gives me a little separation between buttons on the bar.

The spaces in the names should be removed. I agree - all names
are best without any spaces.
(This code was copied into a master source workbook that
I keep special code in for reference - guess it's time to review
some of this stuff and clean it up)

--
steveB

Remove "AYN" from email to respond
"Dave Peterson" wrote in message
...
Do you really use leading and trailing spaces in your commandbars
names?

That would confuse me when I was just looking at the name.

But, heck, I don't even like spaces in there!



STEVE BELL wrote:

Frederic,

Here is some general code to add/delete command bars.
(be sure to fix word wrap)

Use the workbook open (or workbook activate) event to creat the bar
Use the workbook close (or workbook deactivate) event to delete the
bar

Sub CommandBarCreate()
'NewToolBar()
Dim cbrCommandBar As CommandBar
Dim cbcCommandBarButton As CommandBarButton

' If the command bar exits, remove it.
On Error Resume Next
Application.CommandBars(" APW Convert ").Delete

' Add the command bar to the application's
' CommandBars collection.
Set cbrCommandBar = _
Application.CommandBars.Add
cbrCommandBar.Name = " APW Convert "

' Add command button control to the control's
' collection of CommandBar objects.
With cbrCommandBar.Controls
Set cbcCommandBarButton = _
.Add(msoControlButton)

' Set properties of the command button.
With cbcCommandBarButton
.Style = msoButtonIconAndCaption
.Caption = " APW Convert "
.FaceId = 1
.TooltipText = _
"Press me to convert APW."
.OnAction = "apwConvert"
.Tag = "apwconvert"
End With

End With
cbrCommandBar.Visible = True
cbrCommandBar.Left = 125
cbrCommandBar.Top = 150

End Sub

Sub CommandBarDelete()
Application.CommandBars(" APW Convert ").Delete
End Sub

--
steveB

Remove "AYN" from email to respond
"Frederic" wrote in message
...
I have a command button on the toolbar of my excel spreadsheet.
However
I
need to send this spreadsheet out to other people and once sent
to
them,
the
command button doesn't appear on their toolbar. Is there a way of
making
it
happen, or even better is there a way of having the command
button
in
the
spreadsheet (I mean in one cell)?
Any advise, help would be greatly appreciated.

--

Dave Peterson

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson