Results 1 to 2 of 2
2004-07-22, 19:41 #1
- Join Date
- Jul 2001
- Ottawa, Ontario, Canada
- Thanked 1 Time in 1 Post
Trying to run a macro from a different project (VBA 6 Word 2K)
Hello out there
In attempting to run a macro that is contained within another project I have tried the following code unsuccessfully. Can someone please tell me where I have erred?
Answers to questions you might ask:
1. The called project is a template named "MacroSource.dot"
2. Both the calling and called projects reside in the same directory
3. Both projects are Word TemplatesRegards
2004-07-22, 20:16 #2
- Join Date
- Feb 2001
- Silicon Valley, USA
- Thanked 94 Times in 90 Posts
Re: Trying to run a macro from a different project
Application.Run typically is used when the code container is "open" and "in scope" at the time you call the procedure. For example, MacroSource.dot could be open as a global template. You should be able to find the procedure in the macros dialog (unless it takes parameters, in which case Word does not display it there.)
If the template is open, then the next issue is the syntax; a path to a file on disk shouldn't be required, and actually you omitted the file name. For examples of syntax that should work, see <post#=335145>post 335145</post#> and <post#=234629>post 234629</post#>. Someone may post and say that you can't do it without setting a Reference to the other template under Tools>References. Just ignore him.
If the template is not open or in scope, you either can open it yourself (perhaps by adding it as a global template) or perhaps someone has a solution that will dynamically open it.