Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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?





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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?


Reply
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 Problem Dan Excel Discussion (Misc queries) 1 February 5th 10 11:07 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
Macro Problem Angel_24477616 Excel Worksheet Functions 2 March 9th 07 11:28 AM
Macro problem Pete Provencher Excel Programming 3 June 7th 04 08:58 PM


All times are GMT +1. The time now is 05:20 PM.

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"