Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command Button in Excel
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command Button in Excel
Hi Frederic
Insert as button from the Control toolbox or forms toolbar on your worksheet and add the code in the click event or use Assign macro if you use the forms button. -- Regards Ron de Bruin http://www.rondebruin.nl "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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command Button in Excel
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. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command Button in Excel
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command Button in Excel
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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command Button in Excel
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 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command Button in Excel
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 |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command Button in Excel
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 |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command Button in Excel
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 |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command Button in Excel
Dave,
Thanks! (you don't need to reply.) -- steveB Remove "AYN" from email to respond "Dave Peterson" wrote in message ... 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 |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command Button in Excel
Ok.
STEVE BELL wrote: Dave, Thanks! (you don't need to reply.) -- steveB <<snipped |
#13
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command Button in Excel
I pulled abutton into a sheet noe I am unable to find a way to delete it.
going into formula bar doesn't do it. I can get no results with cusor on the button. Was able to cut and paste it to another location this did not remove the origional. Any Ideas HELP "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. |
#14
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command Button in Excel
Turn on your Control Toolbox menubar.
Click on the icon that looks like a set-square and pencil. Click on your button and press delete. "Curt" wrote in message ... I pulled abutton into a sheet noe I am unable to find a way to delete it. going into formula bar doesn't do it. I can get no results with cusor on the button. Was able to cut and paste it to another location this did not remove the origional. Any Ideas HELP "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. |
#15
Posted to microsoft.public.excel.programming
|
|||
|
|||
Command Button in Excel
Oops
Read the question right but answered for a button added to a sheet. Try: Application.CommandBars(" APW Convert ").Delete ' should work. The following will remove all non-standard bars: For Each bar In Application.CommandBars If Not bar.BuiltIn Then bar.Delete Next "Steve" <No Spam wrote in message ... Turn on your Control Toolbox menubar. Click on the icon that looks like a set-square and pencil. Click on your button and press delete. "Curt" wrote in message ... I pulled abutton into a sheet noe I am unable to find a way to delete it. going into formula bar doesn't do it. I can get no results with cusor on the button. Was able to cut and paste it to another location this did not remove the origional. Any Ideas HELP "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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Command Button Excel 2007 | Excel Discussion (Misc queries) | |||
Command Button to store a value in Excel/VBA....... | Excel Discussion (Misc queries) | |||
Excel Add-In with Command Button Controls | Excel Programming | |||
Can I run a macro from a command button in Excel? | Excel Programming | |||
excel, vba, command button | Excel Programming |