Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 23
Default How to run external workbook function/procedure?

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default How to run external workbook function/procedure?

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?

"Vinod" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 23
Default How to run external workbook function/procedure?

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
"Joel" wrote:

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?

"Vinod" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.misc
jaf jaf is offline
external usenet poster
 
Posts: 300
Default How to run external workbook function/procedure?

Hi,
Is the "test" workbook open when you call the external macro?

John


"Vinod" wrote in message ...
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

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
Create a procedure or function Alexandra Lopes Excel Worksheet Functions 0 November 19th 08 10:00 AM
Stop a Procedure from another procedure Ayo Excel Discussion (Misc queries) 1 October 30th 08 01:42 AM
Help with workbook procedure CC Excel Worksheet Functions 0 January 7th 08 05:37 PM
Defined Named cells lined to a Function Procedure swiftcode Excel Worksheet Functions 4 October 11th 05 08:30 AM


All times are GMT +1. The time now is 07:33 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"