How to run external workbook function/procedure?

V

Vinod

Hi All,

The macro which I designed functioning for some input files but not for all.

Here is my requirement, user will open an input file and clicks on run
button from menu options (custom menu from user defined add-in macro which is
already opend).

1. On click of run button an excel template (contains a procedure to update
output sheet calculations) opens from addin location.
2. Opened excel template is assinged to wbkTemplate object.
3. Addin macro copies current input sheet to template and saves the template
with input file name '_Output.xls' using SaveAs.
4. Then Addin macro will call 'Test' procedure in template/saved output.

I'm facing the problem at 4th step from above. To call output file procedure
from Addin I'm using Application.Run WbkTemplate.Name & "!Test". Which is
working fine when open some input files with clicking 'Run' from custom menu.
For some input files which is not allowing to call Application.Run
WbkTemplate.Name & "!Test".

I'm getting error number '1004' and description is 'saved file name'
_Output.xls!Test cannot be found.

Observations:
1. Saved output file name length is 58 characters without spaces.
2. Output file is created in specified path but not able to call a procedure
from it.

Please help me out in resolving the said issue by sharing your thoughts and
expertise in this area which can be appreciated.

Advanced Thanks,
~Vins
 
J

Joel

Can you put a workbook open event in the template to automatically run when
opend so you don't have to call the addin from the remotre workbook?
 
V

Vinod

Thanks Joel for your response,

To answer your question No I cant call the same function in template
workbook open event, since I'm running some other functions from addin before
and after calling template function.

Even way I got the solution in differnt direction, as I said macro is
running for some input files (with short lenght file name). When I took 58
characters length input file name it was failing, So to overcome this I'm
creating 'temp.xls' while exiting I'm saving the temp file with origional
input file name '_Output.xls' at input file path.

-- With Temp.xls the existing code is working without any issue.

Once again thanks for your support.

Regards,
~Vins
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top