Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLE automation with MS-Word
Message
From
19/03/1999 18:17:07
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00193971
Message ID:
00200045
Views:
11
>In order to print a huge report I have created a link with Word.
>When starting the print I notice some strange behaviour within the document that is being created.
>If Word is visible everything works like a charm. However, I don't want to bore my user with Word flashing in front of his eyes so I decided to created the report in the background.
>
>This is when things get vague. When creating tables and leaving them things work fine as long as Word is visible. If Word is not visible the creation of the matrix goes wrong.
>
>Where is my routine going wrong???
>
>Can anyone please help.
>
>Ron Brahma
>
>*********************************************
>testObject = CREATEOBJECT("Word.Application")
>* the dot-file is only used as a template use something else (if you want to...
>testObject.documents.add('c:\temp\test.dot')
>
>testObject.visible= .T.
>=to_word()
>testObject.selection.typetext('You should not be in the matrix' + chr(13))
>
>testObject.visible= .F.
>=to_word()
>testObject.selection.typetext('You should not be in the matrix' + chr(13))
>
>testObject.visible= .T.
>
>return
>
>procedure to_word
>testObject.activedocument.tables.add(testObject.selection.range, 1, 2)
>testObject.selection.typetext(alltrim('This is the first column'))
>testObject.selection.MoveRight(12) &&wdCell
>testObject.selection.typetext(alltrim('This is the second column'))
>
>if testObject.selection.cells.count > 0
> * Make sure you are NOT inside the table
> testObject.selection.movedown(5, 1) &&wdLine, count
>endif
>
>* leave the matrix
>testObject.selection.movedown(5, 1) &&wdLine, count
>RETURN
Ron,
This would produce "selection" problem. Change code as :
* Replace this part
*/*if testObject.selection.cells.count > 0
*/*	* Make sure you are NOT inside the table
*/*	testObject.selection.movedown(5, 1)	&&wdLine, count
*/*endif

* leave the matrix
*/*testObject.selection.movedown(5, 1)	&&wdLine, count
* With
testObject.Selection.Goto(-1,,,"\EndOfDoc") && Predefined bookmark
RETURN
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform