ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   calling Word from an .xlm macro: how to? (https://www.excelbanter.com/excel-programming/312898-calling-word-xlm-macro-how.html)

[email protected]

calling Word from an .xlm macro: how to?
 
Dear all,

I've been using an Excel application for many years now (since 1994 or so) ,
which employs an .xlm file full of macro's.
On of the things it does is call Word for prinitng purposes. Specifically,
after opening Word, it tells word to open a new file based on template
TMPLT, like this:

=FILE.EXECUTE(0;[FileNew.template ="TMPLT"])

This worked fine in Wordbasic times, i.e. up to and including Word 95, of
which I kept a copy around for many years especially for this purpose.
However, that is no longer an option now.

If I try to run my macro against current Word, I get an error like "function
not supported by object", and tracing it yields a temporary VB-module
which contains only this:

Private Sub TmpDDE()
WordBasic.Call "FileNew.template" = "TMPLT"
End Sub

That does not get me anywhere. So what am I to do?

All help very much appreciated!

RS

Jon Peltier[_8_]

calling Word from an .xlm macro: how to?
 
It is possible to call a VBA procedure from XLM. This would be a more robust system.
You could probably find lot of examples in the archives of this group
(http://www.google.com/advanced_group_search).

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

wrote:

Dear all,

I've been using an Excel application for many years now (since 1994 or so) ,
which employs an .xlm file full of macro's.
On of the things it does is call Word for prinitng purposes. Specifically,
after opening Word, it tells word to open a new file based on template
TMPLT, like this:

=FILE.EXECUTE(0;[FileNew.template ="TMPLT"])

This worked fine in Wordbasic times, i.e. up to and including Word 95, of
which I kept a copy around for many years especially for this purpose.
However, that is no longer an option now.

If I try to run my macro against current Word, I get an error like "function
not supported by object", and tracing it yields a temporary VB-module
which contains only this:

Private Sub TmpDDE()
WordBasic.Call "FileNew.template" = "TMPLT"
End Sub

That does not get me anywhere. So what am I to do?

All help very much appreciated!

RS




All times are GMT +1. The time now is 05:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com