Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In an Excel workbook there is some VB coding with various routines. How can
i assign a routine to a toolbar button (I assume this will have to be a macro button) which will trigger the routine. There are no macros in this workbook when you press Alt+F8. Would appreciate your help. dg |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The code is in ThisWorkbook module and one of the procedures is PrintAndSave
which I want to be able to run from the work sheet but I don't know how to. Thank you for your help. Dinesh Gudka "Bob Phillips" wrote in message ... Not clear what you are saying here. If there are no macros, where is the VB code that you refer to? And why do you want to put it to a toolbar button? I assume that the code may be event code, and sitting in a sheet code module or the ThisWorkbook module. Tell us where it is and what you want to do with it. -- HTH ------- Bob Phillips ... looking out across Poole Harbour to the Purbecks "Aless" wrote in message ... In an Excel workbook there is some VB coding with various routines. How can i assign a routine to a toolbar button (I assume this will have to be a macro button) which will trigger the routine. There are no macros in this workbook when you press Alt+F8. Would appreciate your help. dg |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Bob
It does not look as if the procedure has any arguments. This is the code: Private Sub SaveAndPrintInvoice() ActiveWorkbook.ActiveSheet.PrintOut End Sub There are other procedures within the module most of which are without arguments as well, but none of them show up under list of macros! Does this make sense? Dinesh "Bob Phillips" wrote in message ... Dinesh, Just because it's in ThisWorkbook you should still see it from the macro list. If you can't that probably means that it has arguments. In this case, you could create another procedure, in a normal module, to call it with the argument value, e.g. ThisWorkbook.PrintAndSave argValue and then assign this to a toolbar button. If you want it to be dynamic, then you will need to get the argValue via an input box, or the current selection, or whatever. -- HTH ------- Bob Phillips ... looking out across Poole Harbour to the Purbecks "Aless" wrote in message ... The code is in ThisWorkbook module and one of the procedures is PrintAndSave which I want to be able to run from the work sheet but I don't know how to. Thank you for your help. Dinesh Gudka "Bob Phillips" wrote in message ... Not clear what you are saying here. If there are no macros, where is the VB code that you refer to? And why do you want to put it to a toolbar button? I assume that the code may be event code, and sitting in a sheet code module or the ThisWorkbook module. Tell us where it is and what you want to do with it. -- HTH ------- Bob Phillips ... looking out across Poole Harbour to the Purbecks "Aless" wrote in message ... In an Excel workbook there is some VB coding with various routines. How can i assign a routine to a toolbar button (I assume this will have to be a macro button) which will trigger the routine. There are no macros in this workbook when you press Alt+F8. Would appreciate your help. dg |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Aless,
The list will not include macros contained behind the worksheet or macros that are declared as "Private". You macros must be in a standard module and be public. Otherwise - View Toolbars Customize select the Commands tab and goto Macros select one of the two choices and drag it to the tool bar. right click the new button and click Assign Macro select a macro from the list and click OK. steve "Aless" wrote in message ... In an Excel workbook there is some VB coding with various routines. How can i assign a routine to a toolbar button (I assume this will have to be a macro button) which will trigger the routine. There are no macros in this workbook when you press Alt+F8. Would appreciate your help. dg |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dinesh,
These could well be declared as Private procedures, or may even be Functions. Private are only applicable to the module they are in, so they don't show, and Functions return a result, so they don't show either. Does this cover them? -- HTH ------- Bob Phillips ... looking out across Poole Harbour to the Purbecks "Aless" wrote in message ... Hi Bob It does not look as if the procedure has any arguments. This is the code: Private Sub SaveAndPrintInvoice() ActiveWorkbook.ActiveSheet.PrintOut End Sub There are other procedures within the module most of which are without arguments as well, but none of them show up under list of macros! Does this make sense? Dinesh "Bob Phillips" wrote in message ... Dinesh, Just because it's in ThisWorkbook you should still see it from the macro list. If you can't that probably means that it has arguments. In this case, you could create another procedure, in a normal module, to call it with the argument value, e.g. ThisWorkbook.PrintAndSave argValue and then assign this to a toolbar button. If you want it to be dynamic, then you will need to get the argValue via an input box, or the current selection, or whatever. -- HTH ------- Bob Phillips ... looking out across Poole Harbour to the Purbecks "Aless" wrote in message ... The code is in ThisWorkbook module and one of the procedures is PrintAndSave which I want to be able to run from the work sheet but I don't know how to. Thank you for your help. Dinesh Gudka "Bob Phillips" wrote in message ... Not clear what you are saying here. If there are no macros, where is the VB code that you refer to? And why do you want to put it to a toolbar button? I assume that the code may be event code, and sitting in a sheet code module or the ThisWorkbook module. Tell us where it is and what you want to do with it. -- HTH ------- Bob Phillips ... looking out across Poole Harbour to the Purbecks "Aless" wrote in message ... In an Excel workbook there is some VB coding with various routines. How can i assign a routine to a toolbar button (I assume this will have to be a macro button) which will trigger the routine. There are no macros in this workbook when you press Alt+F8. Would appreciate your help. dg |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Bob
You are right, all the procedures are declared as Private Sub ..... I'll remove Private from one of the procedures and see if I can trigger it via macros. Thank you for taking the time and trouble to help me, much appreciated. Dinesh "Bob Phillips" wrote in message ... Dinesh, These could well be declared as Private procedures, or may even be Functions. Private are only applicable to the module they are in, so they don't show, and Functions return a result, so they don't show either. Does this cover them? -- HTH ------- Bob Phillips ... looking out across Poole Harbour to the Purbecks "Aless" wrote in message ... Hi Bob It does not look as if the procedure has any arguments. This is the code: Private Sub SaveAndPrintInvoice() ActiveWorkbook.ActiveSheet.PrintOut End Sub There are other procedures within the module most of which are without arguments as well, but none of them show up under list of macros! Does this make sense? Dinesh "Bob Phillips" wrote in message ... Dinesh, Just because it's in ThisWorkbook you should still see it from the macro list. If you can't that probably means that it has arguments. In this case, you could create another procedure, in a normal module, to call it with the argument value, e.g. ThisWorkbook.PrintAndSave argValue and then assign this to a toolbar button. If you want it to be dynamic, then you will need to get the argValue via an input box, or the current selection, or whatever. -- HTH ------- Bob Phillips ... looking out across Poole Harbour to the Purbecks "Aless" wrote in message ... The code is in ThisWorkbook module and one of the procedures is PrintAndSave which I want to be able to run from the work sheet but I don't know how to. Thank you for your help. Dinesh Gudka "Bob Phillips" wrote in message ... Not clear what you are saying here. If there are no macros, where is the VB code that you refer to? And why do you want to put it to a toolbar button? I assume that the code may be event code, and sitting in a sheet code module or the ThisWorkbook module. Tell us where it is and what you want to do with it. -- HTH ------- Bob Phillips ... looking out across Poole Harbour to the Purbecks "Aless" wrote in message ... In an Excel workbook there is some VB coding with various routines. How can i assign a routine to a toolbar button (I assume this will have to be a macro button) which will trigger the routine. There are no macros in this workbook when you press Alt+F8. Would appreciate your help. dg |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excell error "Can't find Project or Library" Project VBAProject | Excel Worksheet Functions | |||
project | Excel Worksheet Functions | |||
How to convert MS Project to MS Excel. I don't have MS Project. | Excel Discussion (Misc queries) | |||
Need a project. | New Users to Excel | |||
I pay $ for this project | Charts and Charting in Excel |