Macro -> Add-in

jbrouse

Active Member
Joined
Apr 28, 2005
Messages
329
Can a macro be run to install an add-in? Here is my problem:

I use the SendWithLotus function to send my workbook through the network as an attachment in the e-mail. If the user opens the file from the e-mail and tries to run any of the macros, it attempts to open the macro from the original location of the workbook; that is, instead of running Macro(), it tries to run C:\\Documents And Settings\My Project.Macro(), which causes an error since the book is already opened.

Can anyone assist me in fixing this problem so that the macro assignments always run the macro in the open workbook?

Thank in advance for any assistance!
 

Some videos you may like

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Zack Barresse

MrExcel MVP
Joined
Dec 9, 2003
Messages
10,881
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
  3. Web
So the macro is being opened by the email recipient who received the attached workbook? To run the macro, it needs to be installed on the workbook being attached in the email.

I'm wondering how this pertains to your original question though. Does the user have an add-in where this routine is available to?
 

jbrouse

Active Member
Joined
Apr 28, 2005
Messages
329
I'm sorry, it's kind of two questions rolled into one. Please ignore the Add-in portion of the post.

This is my problem in detail:

I have 3 custom CommandBars, with all buttons on each CommandBar assigned to certain macros.

I open up my file, PFLOW.xls, and the macros run fine.

After clicking a button on one of my worksheets, SendWithLotus is called and sends the file as an attachment. I had originally wanted to send a link to the file, but have been informed that this is not possible with the version of Lotus that we have.

When the recipient opens the e-mail and opens the attachment, it opens a temporary file, still named PFLOW.xls.

Now, if the user tries to click any of the buttons on the CommandBars, I get a message that the macro cannot be run because the file PFLOW.xls is already open. This is because now, in the temporary version of the file, the buttons are still assigned to the macros in the original copy of the workbook, meaning that instead of running Macro() from the open temporary file, it tries to open C:\\Documents And Settings\'PFLOW.xls'!Macro(). However, to open that macro, it must first open the workbook, which it cannot do because the temporary file of the same name is opened.

Does that explain it a little bit better?
 

XLGibbs

Well-known Member
Joined
Feb 25, 2005
Messages
2,446
You need to do this:

http://j-walk.com/ss/excel/tips/tip53.htm


use this method to install custom toolbars. it works very well.

The problem you are having is the toolbar button is assigned to a macro in the file. And each time you open the file elsewhere, it looks to run the macro from the saved file.

Use the MenuMaker from John W...you can hide the sheet and have to buttons be made within the code, that will avoid your problem..
 

Zack Barresse

MrExcel MVP
Joined
Dec 9, 2003
Messages
10,881
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
  3. Web
Sounds like you may need to make this an addin and distribute to your users.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,722
Messages
5,573,818
Members
412,551
Latest member
soking
Top