![]() |
macro problem
i have a macro i created that emails worksheets, it needs to be used on
different workbooks, but when i import it into a workbook at runtime it doesn't find it, do i have to save the vbproject first? or does anyone know what is going on? |
macro problem
How did you create the macro?
If you use the VBA editor you can save the macro as part of a worksheet or in the xlb file so it will be there everytime you launch Excel. Inbar. "TommyBoy" wrote: i have a macro i created that emails worksheets, it needs to be used on different workbooks, but when i import it into a workbook at runtime it doesn't find it, do i have to save the vbproject first? or does anyone know what is going on? |
macro problem
i created the macro in one worksheet and then exported it to use it in
other files, because other excel apps will need to use, so i'm trying to do it at run time like this: (it says it can't find the macro) //this will add a reference to outlook excelWorkbook.VBProject.References.AddFromFile(@"C :\Program Files\Microsoft Outlook\OFFICE11\msoutl.olb"); //this imports the macro to my file excelWorkbook.VBProject.VBComponents.Import(@"C:\T emp\ActiveSheet.bas"); //this runs it excelApp.GetType().InvokeMember("Run",System.Refle ction.BindingFlags.Default | System.Reflection.BindingFlags.InvokeMethod,null, excelApp,new Object[]{"'" + emFile.Name.ToString().Trim() + "'!SendActiveSheet.SendActiveSheet"}); Inbar wrote: How did you create the macro? If you use the VBA editor you can save the macro as part of a worksheet or in the xlb file so it will be there everytime you launch Excel. Inbar. "TommyBoy" wrote: i have a macro i created that emails worksheets, it needs to be used on different workbooks, but when i import it into a workbook at runtime it doesn't find it, do i have to save the vbproject first? or does anyone know what is going on? |
macro problem
how do i save it to the xlb file?
Inbar wrote: How did you create the macro? If you use the VBA editor you can save the macro as part of a worksheet or in the xlb file so it will be there everytime you launch Excel. Inbar. "TommyBoy" wrote: i have a macro i created that emails worksheets, it needs to be used on different workbooks, but when i import it into a workbook at runtime it doesn't find it, do i have to save the vbproject first? or does anyone know what is going on? |
macro problem
You don't save macros to xlb files. Inbar is mistaken. xlb files hold
menu modifications. -- Regards, Tom Ogilvy "TommyBoy" wrote in message ... how do i save it to the xlb file? Inbar wrote: How did you create the macro? If you use the VBA editor you can save the macro as part of a worksheet or in the xlb file so it will be there everytime you launch Excel. Inbar. "TommyBoy" wrote: i have a macro i created that emails worksheets, it needs to be used on different workbooks, but when i import it into a workbook at runtime it doesn't find it, do i have to save the vbproject first? or does anyone know what is going on? |
macro problem
You open the xlb from excel, go to VBA, import the code, and save it back to
the xlb. "TommyBoy" wrote: how do i save it to the xlb file? Inbar wrote: How did you create the macro? If you use the VBA editor you can save the macro as part of a worksheet or in the xlb file so it will be there everytime you launch Excel. Inbar. "TommyBoy" wrote: i have a macro i created that emails worksheets, it needs to be used on different workbooks, but when i import it into a workbook at runtime it doesn't find it, do i have to save the vbproject first? or does anyone know what is going on? |
macro problem
Hi Inbar,
See Tom Ogilvy's adjacent response to TommyBoy! The xlb file stores toolbar customisations - it does not (and cannot) store macros. Opening the xlb file restores the toolbar configurations that applied when Excel was last closed, it does not present a VBA-readable file. --- Regards, Norman "Inbar" wrote in message ... You open the xlb file, go to VBA, add the macro, and save it back. "TommyBoy" wrote: how do i save it to the xlb file? Inbar wrote: How did you create the macro? If you use the VBA editor you can save the macro as part of a worksheet or in the xlb file so it will be there everytime you launch Excel. Inbar. "TommyBoy" wrote: i have a macro i created that emails worksheets, it needs to be used on different workbooks, but when i import it into a workbook at runtime it doesn't find it, do i have to save the vbproject first? or does anyone know what is going on? |
All times are GMT +1. The time now is 12:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com