Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OLE automation with MS-Word
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00193971
Message ID:
00200014
Vues:
13
Ron,

What types of things are going wrong? Are you getting error messages?

>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
Rick Hodder
MCP Visual Foxpro
C#, VB.NET Developer
Independent Consultant
www.RickHodder.com
MyBlog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform