Member Login
member
passwd
remember me on
this computer.

- join now -
- forgot username or password? -

Jump to a Date

Sponsored Communities
Cool stuff
Select a topic of interest:
...and press:
Neat Stuff
Control.com Stuff

Visit our shop for nerds in control lifestyle products.

Fortune
Mollison's Bureaucracy Hypothesis:
If an idea can survive a bureaucratic review and be implemented
it wasn't worth doing.
RSS Feed
RSS feed Use this link to get an RSS feed of the Control.com article flow, for private, non-commercial use only:
www.control.com/rss/
To get a personalized feed, become a member at no cost.
Select a Page Style
Select one of the following styles:
- BluFu
- Classic
(cookies required)
advertisement
from the None department...
Open a MS Word document from InTouch and go to a specific bookmark.
Human-Machine Interface and SCADA. topic
Posted by Øyvind Haugland on 10 April, 2002 - 10:05 am
I would like to open a MS Word document from InTouch and go straight to a specific bookmark in this document. Has anyone done this?

Øyvind Haugland


Posted by Anonymous on 10 April, 2002 - 6:12 pm
You can try 2 Wonderware script functions startapp to open word and a specific doc then have wwexecute call a macro in word that goes to a specific bookmark.


Posted by Øyvind Haugland on 11 April, 2002 - 10:51 am
> You can try 2 Wonderware script functions startapp to open word and a specific doc
> then have wwexecute call a macro in word that goes to a specific bookmark.

Thanks for all the answers. Here is how far I've come (still not able to run the macro in word, but I'm close to it):

This is a script that runs the macro "Makrotest" in Excel (Macro and Command are defined as MemoryMessagetag, Excel is already running in the background with the sheet "DDE_Test"):

Macro = "DDE_Test.xls!Makrotest";
Command = "[Run(" + StringChar(34) + Macro + StringChar(34) + ")]";
WWExecute( "excel", "system", Command );

It works! But let's make an equal script for running script in Word:

Macro = "Bookmark";
Command = "[Run(" + StringChar(34) + Macro + StringChar(34) + ")]";
WWExecute( "winword", "system", Command );

This doesn't work! I get the errormessage "Compile error: Sub or Function not
defined" in VB, and the macro "TmpDDE" were tried started (although I have made a macro in Word called "Bookmark" and run OK in Word).

I looked at the MS Webpage
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q17 7760. There it says how to run macros in other programs:
Excel: XL.Run "TestMacro"
Word: WD.Run "Project.Module1.WordMacro"

I tried to put in projectname and modulename in addition to the macroname, as this page says, but I wasn't able to run it without errors.

Does anyone have experience with/suggestions to how to solve this?


Posted by T. Connolly on 10 April, 2002 - 6:22 pm
No, and I don't know how you would. Perhaps a VBA macro in word might do it. You might try converting the file to HTML and opening it with a browser from InTouch. Most HTML books cover how to do this.


Posted by Greg on 10 April, 2002 - 6:29 pm
Create a button with an action link using the "Startapp" command. See your Help files for detailed description.

It would be something like;

Startapp "path1/winword.exe path2/filename.doc";

Note that the 'path1/' part must be the path to winword and 'path2/' must be the path to the file.
The path must not have any spaces in it as Winword doesn't seem to like this.

This will get Winword running with your file open (if your file exists). If it doesn't exist, it will at least get winword open. As for getting to a bookmark in the file, you're on your own.

Be careful to password protect this link as it is very easy for a reasonably smart guy to get to the internet through winword. This would open your system to all sorts of porn (and/or viruses if you have no firewall but have ADSL or cable
connection to the internet).

Good luck,


Posted by Morten Johansen on 11 April, 2002 - 10:44 am
Øyvind,

Try to use
(From InTouch)
*WWStartApp to launch winword
*WWExecute to launch your Word Macro

(From Word)
*A Macro

You should make a tag which hold your bookmark value. This tag can you put in in a cell in the document. This cell read the value of your tag = the macro can read it.

The macro is moving you around in the document based on your bookmark value given from InTouch.

Morten Johansen
www.aventi.no


Posted by Sharon on 7 June, 2002 - 1:43 pm
Try Creating a macro that runs when you open the WORD document. Example (The name of the bookmark is "scope")::

Sub AutoOpen()
'
' Auto_Open Macro
' Macro created 6/7/02
'
Selection.GoTo What:=wdGoToBookmark, Name:="Scope"
With ActiveDocument.Bookmarks
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
End Sub

From Control Engineering magazine...
Related articles from Control Engineering magazine
Above articles copyright 2009 Reed Business Information. Subject to its Terms of Use.
Your use of this site is subject to the terms and conditions set forth under Legal Notices and the Privacy Policy. Please read those terms and conditions carefully. Subject to the rights expressly reserved to others under Legal Notices, the content of this site and the compilation thereof is © 1999-2009 Nerds in Control, LLC. All rights reserved.

Users of this site are benefiting from open source technologies, including PHP, MySQL and Apache. Be happy.

Control Engineering magazine subscription
Advertisement
Our Advertisers
Help keep our servers running...
Patronize our advertisers!