Sending MACROS to Users


Posted by bill.roberts on March 06, 2000 1:35 PM

How do you send MACROS (*.bas) to users which auto install into users PERSONAL.XLS??

bill

Posted by bill.roberts on March 07, 2000 7:39 AM

OK, I've been thinking about it and is seems that you can send someone an XLS file which has the VBA built in to modify a persons PERSONAL.XLS.

How would I go about doing that?

Posted by Bruce on March 07, 2000 8:49 AM


Bill,

This may work, I had a similar issue wanting to use VBA to copy a macro from one worksheet to another:

Here is the code.

'Copy the required macros over to new workbook
ThisWorkbook.VBProject.VBComponents _("Module_Name").Activate
ThisWorkbook.VBProject.VBComponents _("Update_Summary").Export ("Module_Name")

' This will save the module name to your last 'active path form there you can send to whomever
'to import the module use

ActiveWorkbook.VBProject.VBComponents.Import _("Module_Name")
Kill "Module_Name" ' Deletes macro file.

Posted by bill.roberts on March 07, 2000 11:15 AM

I think the BUFFET at lunch dulled my brain!

1) set focus to macro to replicate
2) "Update summary" is?
3) Import line grabs from a file? No, an open workbook?

Confused. But darn was the Generals Tso's good!

Seems like step 1) can be deleted.

NOT CRITIZING! Only trying to understand.

UPDATE SUMMARY is the workbook containing the "to be exported" macro.

VBA did not like the UnderscorE after VBcomponents.

Help...

Posted by Bruce on March 09, 2000 12:54 PM

I found that to export a module from a VBA project you first have to activate it (Line 1)

the second line will export ( save) the module to your active directory as a file with the module name with no extension.

You can then send that file to whomever.

ThisWorkbook.VBProject.VBComponents _("Module_Name").Activate
ThisWorkbook.VBProject.VBComponents _("Module_Name").Export ("Module_Name")

the last line ( in original message) will import that file as a module into an open VBAproject

hope this works for you

Posted by bruce on March 09, 2000 12:56 PM

The underscore is just a line continuation in VBA

if the code is all on one line you can omit the _



Posted by bill.roberts on March 09, 2000 1:33 PM

Thank you Bruce!

The "_" did throw me off a bit but the code works

Thanks again
Bill