LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default Having macro add PasteSpecial Values button to toolbar

Thanks! I had figured out the Count property, but what was holding me back
was not knowing about the ID property. This is what I simplified it to:

Sub AddPasteValuesButton()
' adds PasteSpecial Values button to Standard toolbar

Dim i As Integer

' if no Standard toolbar we do nothing
If Not Application.CommandBars("Standard").Visible Then Exit Sub

' check for existing PasteSpecial Values button
For i = 1 To Application.CommandBars("Standard").Controls.Count
If Application.CommandBars("Standard").Controls(i).ID = 370 Then Exit Sub
Next i

' check for Copy button (so we can paste to its right)
For i = 1 To Application.CommandBars("Standard").Controls.Count
If Application.CommandBars("Standard").Controls(i).ID = 19 Then
Application.CommandBars("Standard").Controls.Add Type:=msoControlButton, ID:=370, Befo=i + 1
Exit Sub
End If
Next i

' no Copy Button on the toolbar, so place PasteSpecial Values somewhere
Application.CommandBars("Standard").Controls.Add Type:=msoControlButton, ID:=370, Befo=10

End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro button on toolbar Daniel Charts and Charting in Excel 0 August 27th 07 08:56 PM
Button with macro in toolbar Daniel Charts and Charting in Excel 1 August 25th 07 02:39 AM
Command Button for PasteSpecial - Values - Transpose Alisha Excel Discussion (Misc queries) 0 March 10th 06 09:39 PM
Toolbar button To Run a Macro? jon Excel Programming 1 November 17th 03 07:07 PM
How do I make a button to PasteSpecial Values only. Rick[_17_] Excel Programming 2 November 5th 03 01:34 PM


All times are GMT +1. The time now is 09:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"