Launch Microsoft Word

Discussion forum about all things Team Developer 5.x and 6.x
kclench
United States of America
Posts: 72
Joined: 26 Jun 2017, 23:22
Location: Ventura, CA, USA

Launch Microsoft Word

Post by kclench » 06 Nov 2017, 23:11

Hi all,
What is the best way to call Word (with a file that needs to be launched) from Team Developer, not using ActiveX?

For very many years, we successfully ran an implementation using ActiveX to launch Microsoft Word for mail merges. Security patches applied recently to the operating system and/or Office cause ActiveX to be stopped. So I changed the call to
If NOT SalLoadApp( 'cmd /c '||fsTempFile, '' )
Call SalMessageBox(' Failure attempting to run cmd/c '||fsTempFile, 'Application Did Not Launch', MB_Ok )

where fsTempFile is a Word document of type .docm (with macros)

Now the problem is that the command window is open, the merge happens, but because the VB macro is written to close the source document, leaving only the new merged document on the screen, it looks like a blank document on the screen, with all icons and ribbons greyed out. I can save the visually blank file, then open it, and all the text is correctly there.

I tried to comment out the close source document line in the VB, but that isn't the right approach because the end user will not know to do all the right keystrokes.


thank you,
Karen

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 1137
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Launch Microsoft Word

Post by Dave Rabelink » 07 Nov 2017, 11:26

Hi Karen,

Use WinApi function ShellExecute.
Pass in the complete filename of the document and this will then be automatically opened in Word.

Use this sample:
WIKI_ShellOpenWith.zip

Use the browse button to select a .docm file and press OpenWith button.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

kclench
United States of America
Posts: 72
Joined: 26 Jun 2017, 23:22
Location: Ventura, CA, USA

Launch Microsoft Word - SOLVED

Post by kclench » 07 Nov 2017, 17:42

thank you very much, ShellExecute worked.

clemdoc
Austria
Posts: 12
Joined: 08 Mar 2017, 09:51
Location: Austria

Launch Microsoft Word

Post by clemdoc » 08 Nov 2017, 10:24

Hi!
kclench wrote:
06 Nov 2017, 23:11
Security patches applied recently to the operating system and/or Office cause ActiveX to be stopped.
Would you mind going into more detail as to what precisely caused Word/ActiveX to stop working?
I'm asking purely in self-interest as we might face the same problems.
Greetings, clem

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 151
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Launch Microsoft Word

Post by thomas.uttendorfer » 09 Nov 2017, 15:57

Hi Karen,

we use TD 7.0.2 32-Bit together with Office 2016 32 Bit on Windows 10 Pro 64-Bit.
All Windows software is up to date.
We don't face any problems starting Word via COM.

Could you please describe your issues?

Regards Thomas
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

kclench
United States of America
Posts: 72
Joined: 26 Jun 2017, 23:22
Location: Ventura, CA, USA

Launch Microsoft Word

Post by kclench » 09 Nov 2017, 22:43

Hi all,

The Word documents in question have an autorun macro and other mail merge code in macros. Non-macro Word still works with ActiveX. The client site is Windows7 64bit, Office 2010.

I don't know why it stopped working or what security measures were implemented. It was at a client site. Their IT department did not tell me what was applied over that weekend. I was told the letters not launching was the way Word was invoked.

Sorry I don't have more information.
Karen

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 151
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Launch Microsoft Word

Post by thomas.uttendorfer » 10 Nov 2017, 08:52

Hi Karen,

we also do mail merge. But we don't use autorun macros.
Instead we use the COM/ActiveX-functions from within gupta
to do all the mail merge.

Regards Thomas
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot], efarina and 0 guests