Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Excel


Add Icon To Macro Button Using VBA

The following code is for a macro button I have setup, but it is in text only form. I want to add an icon to the text. Also, are there other icons to use than the lame ones from Microsoft?

Dim myButton As CommandBarButton
Set myButton = Application. CommandBars("Worksheet Menu Bar").Controls.Add
myButton.Caption = "Hours Entry"
myButton.Style = msoButtonCaption
myButton.BeginGroup = True
myButton.OnAction = "Show_"

View Complete Thread with Replies

Sponsored Links:

Related Forum Messages:
Button Icon Folder Location
I am running WinNT and need to find the folder containing the default icons available for use on buttons in the toolbar window. I can copy the image but it saves as a picture (device independent bitmap). I want to be able to send the icon to other people so they can put it in their directory and choose to select it.

View Replies!   View Related
Insert An Icon Relative To The Button Location
I was wondering if i could get a hand with inserting a file. Is there a way to insert the file and have it placed a relative distance from the insert button without using cell references?

View Replies!   View Related
Disable Macro Icon In Menu Bar
i have 2 macro icons.

i want to disable the icons after its clicked once.

View Replies!   View Related
Macro Works With Form Button But Not Command Button
This is probably really straight forward but cant see why it happens, the following macro works fine when called by a button created by the form toolbar but doesnt when called by a command button, get the runtime error 1004, "select method of range class failed"


View Replies!   View Related
Changing Icon
I'm using the bellow code which I think Igot from this site, to change the excell icon to my own, Only thing is that in the top left hand side of the workbook still says: "Microsoft Excel - My File Name". Does any of you fine people know how to get rid of the Microsoft Excel and show only "My File Name"?

Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long
Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long

Const WM_SETICON = &H80

Sub setExcelIcon()
Dim lngXLHwnd As Long, lngIcon As Long, strIconPath As String

strIconPath = "My Path:MyIcon.ico"
lngXLHwnd = FindWindow("XLMAIN", Application.Caption)

lngIcon = ExtractIcon(0, strIconPath, 0)

SendMessage lngXLHwnd, WM_SETICON, False, lngIcon

End Sub

View Replies!   View Related
New Command Icon
I'm looking to have a doc where people time stamp their start and stop times. I have found that Control(apple) - Shift -semi colon works. The problem i'm having is that I want people to be able to use a command icon in their toolbars for this task as opposed to people have to use the keyboard. I can use a button with a macro but this is not possible as our excel corrupts when there are too many macro's

View Replies!   View Related
Change Desktop Icon
I was wondering how I could change my desktop icon for one specific workbook to something other than the excel icon. I saw the below link (2nd tip) but that changes the icon for every file of a specific file type. I just want to change one specific file's icon on my desktop to something custom, like a clipart picture of my choosing. I also know that this can be done with shortcuts, but I need it to be changed on the original file. I tried using the IconChanger program, but the icon stayed with the file name so if I did a "save as" or emailed the file, it disappeared. I want it to stick with that file for good, or any file I duplicate from the original, and work on other computers as well.

View Replies!   View Related
Put An Icon In The Title Bar Of Workbook
Excel 2003. How can I put an icon in the title bar of an Excel Workbook? And can it be a .jpg or does it need to be a .icon. How can I put a title and NOT see " Microsoft Excel" in the title bar.

View Replies!   View Related
Change Shortcut Icon
How can I change an excel document's icon so it's not obvious until you click on it that the file is an excel one? I don't want to do the create shortcut business.

View Replies!   View Related
Macro Doesn't Work On Button, But Fine From Macro Menu!
I've recorded a macro that copies an entire tab into a new spreadsheet then goes on the copy and paste information from one tab to another.

When I run the macro from the Tools>Macros menu it works perfectly.
But when I copy the code and add it to that of a button it fails and posts the following error: Run-time error '1001': Select method of Range class failed.

The first attachement shows the code for the macro as it is alone, and the second shows how I simply copied and pasted it into the 'view code' window of the button.

Needless to say I'm a beginner at macros and only every record them, I can usually make stuff work that way but this has me stumped!

View Replies!   View Related
Lost Relative Reference Icon
I went to record a macro but I can't seem to get the relative reference button anywhere. I am using Excel 97 - does anyone know why this might be or how I can get it back?

View Replies!   View Related
User Programable Icon On Toolbar
I have an application macro which displays a Userform which lists and lets me select/load my favorite XL WBs. It also lets me add and/or delete favorites.

At present, I have to activate it with a Ctrl+Key combination.

Is there anyway I can assign it to an icon on the toolbar.

View Replies!   View Related
Change Desktop Excel Icon
I was wondering how I could change my desktop icon for one specific workbook to something other than the excel icon. I saw the below link (2nd tip) but that changes the icon for any file of a specific file type.

I just want to change one specific file's icon on my desktop to something custom, like a clipart picture of my choosing. I've seen it done with certain companies changing the internet explorer shortcut icon linked to their webmail, changing it to their logo.


View Replies!   View Related
ActiveX Comboboxes Change To Icon
I have one sheet with about 100 activex controls (and another few 100 on the other sheets in the file), most combobox, but some checkbox as well. There are 30 of them lined up, one in each row. One at a time, one control will basically change to an icon only. If you select it in design mode, the name shows in the range name area of the toolbar, but when you select properties you get the properties for the sheet. Effectively I have an icon with nothing linked to it anymore.

For a while, it seemed to be somewhat random. But for the last few days, it is now cascading down. First combobox #6, then #7, etc. I'm now on #11 or so. Seems to happen when you save then reopen the file, not if you just keep working in the file without closing it.

The macros behind the boxes are still there and run once I recreate the missing box (normally with an Alt-D, and editing the properties; but I've also created from scratch from the toolbar, and used alt-C, alt-V) they work fine. I've run a compile, with no change. Any thoughts on finding the root cause? I thought it might be from blowing up a macro, but I've tried it without even editing a macro and it has the issue.

View Replies!   View Related
Add Icon To Custom Toolbar Menu
how to manage a custom faceid. Though, I am not too sure as to how to assign an actual icon to a custom toolbar. I can try the pasteface method; though as the source file is a .png; the picture might be too small.

View Replies!   View Related
Managed To Change The Icon On The Title Bar
I have managed to change the icon on the title bar but is it possible to change the "MICROSOFT EXCEL" wording next to the icon on the title bar

View Replies!   View Related
Creating A Macro, That Creates A New Button, Which Itself Runs A Macro..
I have a long complicated macro that processes a ton of data and gives the output in a new sheet. I then want to create new buttons (or some sort of user clickable triggers) on this new sheet that runs another macro.

I have got the actual adding of buttons in the sheet working, but I can't find a way to automatically assign macros to newly generated buttons during runtime. Is this even possible (or are there any clever tricks I could use to get around this?)

View Replies!   View Related
How To Do Pull-Down Menu With Colored Graphics Icon?
I'm trying to do a pull down menu with three selections - green,yellow, and red dots? I set up the data validation and referred it to a list. That is under Data Validation -> Settings -> Allow: List; Source: a range of cells where I put 3 colored dots(graphics). Now in the pull down menu when I select the first choice, it just gives me a black dot. The second choice gives me the same black dot. And so does the 3rd choice gives me a black dot.

So, how do I carry the 3 colored dots over? Or it's not possible using the Data Validation approach? If not what is the best and easiest way to go about doing this....

View Replies!   View Related
Get Exclamation Mark Icon And Sound For A Userform
Is it possible to get the exclamation mark icon from the builtin msgbox function to use on a userform?

View Replies!   View Related
Rename Word Object File Icon
I've added an word object to my excel sheet as an icon. The only problem is that it shows the word icon then under it says 'Microsoft Word Document'. This might be an obvious and silly question. But how do I Rename the 'Microsoft Word Document' to a title of my choice?

View Replies!   View Related
Anyway To Create Shortcut Icon To Open A Specific Worksheet?
Is there anyway to create a shortcut icon that I can place on my windows Desktop - That when launched will open a workbook to a specific worksheet/tab. Has to be a windows shortcut as the workbook is auto generated eachday and sent to me, so if I add vb code it will not matter as I will get a new workbook the next day thus wiping out the vb code.

The person who compiles it leaves it on a certain tab that I dont need, but is commonly used by other people - so I would like a shortcut to skip that worksheet and take me to the worksheet that I need to use.

View Replies!   View Related
Custom Floating Toolbar Created - Icon And Size Questions Remain
I have created a custom floating toolbar that works perfect (thanks to all the reading on here!). My workbook is a stand alone estimating tool that many users will have a copy of.

I have two things I want to do yet but I cant find it on here.

1) My buttons on my toolbar - I want to have custom icons. I can do this temporarily but when I exit my worksheet and re-open they are lost. Is there anyway to save a custom icon. I am willing to add it to the icon list if necessary and then when users open the workbook copy the custom icons onto their computer. But I am not sure how/where I could do this.

Worse case, can I color my button text?

2) When my toolbar appears, it is wide, all buttons are going left to right. I want the size to be small width so the toolbar buttons are on top of each other. Any thoughts? I tried adding a .width but it didnt work.

View Replies!   View Related
Macro To Reassign A Macro To A Button
Upon opening the worksheet, I'd like to have a startup macro reassign a macro to a button that is already created. We have an issue with two buttons in a custom toolbar that for some reason default to an old (nonexistent) version of the file when looking for the assigned macro. If I could get an opening macro to automatically reassign those buttons to the proper macros inside the current file, then we wouldn't have to have all possible users login and reassign and resave, which seems to be the only solution at the moment.

Reassigning a macro to a button doesn't show up when doing "Record Macro", and if creating a new button and assigning correct macro while "Record Macro" is occurring, VisualBasic only shows the creation of the button and not the assignment of the macro.

View Replies!   View Related
Macro In A Button
i have macros which is attached in notepad and need to be called into 1 single button .

I have tried few ways but throwing an error.

View Replies!   View Related
Have Button Run Macro
I am new to insert buttons and I i figured how to drag one and put it in the toolbar at the top to perform a macro when it is pushed. I saw somewhere where someone had a button in say A1 that performed a certain macro and then one in A2 that performed another macro. how to insert a button in both of these cells that I can link to a macro to insert data into a specified cell?

View Replies!   View Related
Input Box Next To A Macro Button
I have this macro in which the user clicks a button and it formats a file for them. I want a box next to the button where the user can enter a number first then click the button and then the file will use that number to calculate a column. Any help is appreciated.

For example part of my macro is this.

Lcol = Range("IV5").End(xlToLeft).Column + 1
Cells(5, Lcol) = "Total Cost"
Worksheets("sheet1").Range("u6").Formula = "=IFERROR((RC[-1]/RC[-3])*the number the person entered first,0)"
Lrow = Range("A" & Rows.Count).End(xlUp).row
Range("u6").AutoFill Destination:=Range("u6:u" & Lrow), Type:=xlFillDefault
With Range("u6:u" & Lrow)
.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
End With
Application.CutCopyMode = False

View Replies!   View Related
Run A Macro From A Command Button
I have created a command button from the Excel 2003 from the Macros toolbar that I placed on my worksheet. I want to use this button to activate an existing macro. Currently I have no code entered for this button and the button when clicked on behaves as an object to be edited, moved, etc. How should I proceed?

View Replies!   View Related
Print Button Macro ..
I have a workbook with approximately 260 sheets. These sheets contain financial information. They have to be sorted according to the division within the company, with a total page for each financial division.

I have a code on a blank tab that prints the sheets based on a value in cell B3 on each sheet. (i.e. "VB", "WB", which are initials of our district managers.)

View Replies!   View Related
Button With Macro Do Nothing When Click On It
On a spreadsheet I have a button which has a macro assigned to it, for some reason when I protect the worksheet then then click the button, nothing happens (or though I do get egg timer for a second). but when I unprotect the shet its fine.

ive used this type of method many tiems, and cant see what the problem is, have tried all combination of locking and unlocking cells in and around etc, but nothign changes it.

View Replies!   View Related
Print Macro Button
I need to know how to make a box that says "print" which will print out pages in my excel file... What I am picturing is this:

Tab 1 Y
Tab 2 Y
Tab 3 N
... etc.

Making a table as the one above, and depending on whether I input "Y" or "N", it will print that tab...

i've seen this in some financial models and would like to incorporate it into my model. If you could offer some detailed help, it would be greatly appreciated. Please note that I am a complete beginner and would need to be taken step-by-step.

View Replies!   View Related
Macro For Printing :: By Hit Of Button
i am after a macro that will print multiple sheets in hit of a button, the ranges are from A1 to the last row of the data. Now there are sometimes cells which have no data, so was not sure if this will be a problem. At momenet it take me at least couple of minutes to print everything out.

View Replies!   View Related
Macro With A Button Click
I have many workbooks that I receive from clients I run various Excel VBA macros on depending on which workbook it is, and I need to automate all of this so that anyone can run an simple .exe user interface designed in VB 2005 Express Edition where when that interface is run, a window opens on the destop with a collection of buttons, when the user clicks one of the buttons, Excel launches, loads the appropriate file and runs an already-existing appropriate Excel macro, then some file maintenance is done, like moving a group of files from one subdirectory to another.

View Replies!   View Related
Making A Macro Run From A Button In Different Tab.
I have an excel spreadsheet with two tabs.One called "menu" and one called "website"
I want to put a button in tab one (menu) and assign a macro. I need the macro to run/output in sheet 2 (website) not in sheet 1 where the button is placed.

No matter what I do I can't figure it out. The macro always runs in the same sheet as the button.

View Replies!   View Related
Macro For Button On Worksheet
I am trying to make a button that puts the formula back into the cell after a manual entry

View Replies!   View Related
Macro Button On Desk Top?
I need a thrid party program to be able to run excel and word macros from my desk top? I can build the buttons but I would like to make a tool bar that I can place on my desk top, I have about 15 macros I use all the time.

I just had a second thought well not mine my daughter, she suggested that I use a gaming keyboard which already has extra keys. She has one, it has 15 extra keys. Has anyone ever tried to program macros to something like this? I still prefer having a tool bar on my desk top but it is a creative idea. I just don't know if Excel or Word would recognize the extra keys.

View Replies!   View Related
Spin Button Macro
I don't know much about VBA, but I am sort of working my way through. I have inserted a spin button in an excel sheet and assigned it to the following code in a module:

Sub SpinbuttonD4()
Range("D4").Value = Range("D4").Value + 0.01
End Sub

So, now when I click the spin button (either the up arrow or the down arrow), the value in D4 increases by 0.01.

What I actually want to do, however, is for the value in D4 to increase by 0.01 when I click the up arrow, and decrease by 0.01 when I click the down arrow.

View Replies!   View Related
Macro In A Toggle Button..
it's possible to use this macro code in a toggle to perform this action when it's true and when the toggle is click again it can undo it.

This macro does lookups and finds the max on sets of value when it is run and i was wondering if by clicking the button again it can undo what it placed in the cells.

View Replies!   View Related
Protect A Button Containing A Macro?
I have button on a worksheet that has a macro assigned. I need other people to see the workbook, but I want the button DISABLED for them to click, but able for me to click it. I have written in the macro to protect the sheet once it has run, but the button is still pressable.

View Replies!   View Related
Macro To Be There In Single Button
I have a macro which was developed with the help of our Experts.

I need all that macros to be in 1 button would that be possible.

I have tried this but not able to make it.

View Replies!   View Related
Assign A Button To A Macro
While practicing writing macros and studying the VBA code, I decided to add a button to run the macro, something I've done many times in the past. But the option to associate the new button with any macro doesn't seem to be available.

A. How can I assign a new button to a macro


B. How can I make the association in VBA?

View Replies!   View Related
Insert Row Next To Macro Button
I've got some rows containing formulas under one of several header rows. I'd like to insert a button in column A of the header row which will insert rows below that header. I've got it working using absolute and relative references, but don't know how to determine where the button is located in order to insert below the right header row.

Hopefully that makes sense. If needed I can attach a sample spreadsheet.

Current macro

Sub Test()
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
ActiveCell.Offset(2, 0).Rows("1:1").EntireRow.Select
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False
End Sub

View Replies!   View Related
Macro Button On Different Sheet
If I have a button on Sheet2, what is the correct VBA code to put on the ThisWorkbook code sheet so that it gets run?

View Replies!   View Related
Command Button / Macro
I am trying to attach a recored macro to work via a command button - but keep getting the error message "select method of Range class failed.

When I run the macro through the normal way it works, but I want to be able to click on a Command button for it to work.

I have copied the recorded macro code to the command buttons code field

Do I need to use the code for the Cmd Btn to tell it to run the Macro -

View Replies!   View Related
Macro Button That Is Always Shown
How do I programmatically freeze ( lock?) an autoshape so that it stays put even when the user scrolls up/or down?

FYI: I created an autoshape and assigned it a macro, thus it becomes a software button, I want the button to stay put.

View Replies!   View Related
Attached A Macro To Button
I attempted to attach the following Macro to a button. But when I tried to run it the following errors: Complie ErrorInvalid inside procedure.

Sub commandButton()
Option Explicit
'Dim MyArray(6, 4)
Dim MyArray(200, 4)
Public MyData As Range, c As Range

Private Sub cmbAdd_Click()
'next empty cell in column C
Set c = Range("c65536").End(xlUp).Offset(1, 0)
Application. ScreenUpdating = False ' speed up, hide task
'write userform entries to database
c.Value = Me.Textbox1.Value
c.Offset(0, 1).Value = Me.TextBox2.Value
c.Offset(0, 2).Value = Me.TextBox3.Value
c.Offset(0, 3).Value = Me.TextBox4.Value
c.Offset(0, 4).Value = Me.TextBox5.Value.....................

View Replies!   View Related
Toolbar Macro Button
I've created a custom toolbar via Excel's toolbar wizard, to which I have added several macro buttons. However, when clicked, instead of running the assigned macro, Excel instead attempts to open my already open file?? I think I read something about having to manually change the buttons to refer to a .xla ??? Not sure though.

View Replies!   View Related
Button To Excecute/Run A Macro
I would like to write function that will excetute when a user click buttun that is marked on that link: i make that button with that

ActiveSheet. OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False _
, DisplayAsIcon:=False, Left:=384.75, Top:=182.25, Width:=94.5, Height _
Selection. Name = "NarisiGrafeGumbek"

how to do that if i am doing like normal button it dont work

View Replies!   View Related
Call A Command Button In A Macro
I have created a command button so that the sheet asks for a password. Now I need to include that in an already created code. I have created a command button as:

Private Sub CommandButton1_Click()
If LCase(Me.TextBox2) = "password" Then
Run "Showall"
Run "Hideall"
End If
End Sub

Can someone tell me how to call this macro in another macro. That is when another macro is running and if the condition fails, this macro should be called. Is it something like run "CommandButton1"?

View Replies!   View Related
Macro For Command Button To Transfer Value
I need a macro for a command button to perform the following:

If B8 is the active cell and I click the command button,
transfer value from:

B3 to B8
D3 to D8
E3 to E8
F3 to F8
G3 to G8
H3 to H8
I3 to I8

Likewise, if B9 is the active cell and I click the command button,
transfer value from:

B3 to B9
D3 to D9
E3 to E9..........

View Replies!   View Related
Macro To Print A Worksheet With A Button
I am trying to create a simple macro to print a worksheet with a button. The worksheet will have additions/deletions on a daily basis, so it need to adjust accordingly. I cannot figure out how to do the loop macro.

View Replies!   View Related
Copyright 2005-08, All rights reserved