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

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

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,122,319
Messages
5,595,465
Members
413,992
Latest member
CSEGUIN1973

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top