MS PJ 2000 and MS Word via VBA 
Author Message
 MS PJ 2000 and MS Word via VBA

Hello,
I need to export some data from MS Project to MS Word. (VBA)
How can I load MS Word  with a specific document and activate the following
menu commands :
 - Edit / Paste
 - Insert / Insert page-break
Thanks for help,

Grard Ducouret



Mon, 30 Aug 2004 01:29:42 GMT  
 MS PJ 2000 and MS Word via VBA
Try This:
First Set a reference to the object lib for your version of Word. (Tools
| References)

Sub GetWord_OpenDoc_Paste_PageBreak_Save_CloseWord()

Dim wdApp As Word.Application

Set wdApp = New Word.Application

With wdApp
    .Documents.Open FileName:="c:\test.doc"

    .Selection.Paste
    .Selection.InsertBreak Type:=wdPageBreak
    .ActiveDocument.Close SaveChanges:=True

End With

wdApp.Quit
Set wdApp = Nothing
End Sub
--
Brian K
MS Project MVP



Mon, 30 Aug 2004 08:23:01 GMT  
 MS PJ 2000 and MS Word via VBA
Thanks a lot,

Gerard



Quote:
> Try This:
> First Set a reference to the object lib for your version of Word. (Tools
> | References)

> Sub GetWord_OpenDoc_Paste_PageBreak_Save_CloseWord()

> Dim wdApp As Word.Application

> Set wdApp = New Word.Application

> With wdApp
>     .Documents.Open FileName:="c:\test.doc"

>     .Selection.Paste
>     .Selection.InsertBreak Type:=wdPageBreak
>     .ActiveDocument.Close SaveChanges:=True

> End With

> wdApp.Quit
> Set wdApp = Nothing
> End Sub
> --
> Brian K
> MS Project MVP



Wed, 01 Sep 2004 19:04:11 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. MS PJ 2000 and MW Word

2. Executing MS SQL Server 2000 stored procs via MS Access 2000

3. Adding VBA to a MS Word 2000 Header -- How To

4. Print out MS Outlook calendars via VBA WITHIN MS Outlook

5. mail-merge MS Word and MS Access via ASP

6. how to control MS word via MS Basic script

7. MS Word VBA with MS Graph

8. MS Word VBA with MS Graph

9. Picture to Ms Word via VBA??

10. Delete a command in a MS PJ menu

11. Q:Envoking MS-Word from VB4 when Exchange is using MS-Word

12. Driving MS Project from MS Access 2000 developed application

 

 
Powered by phpBB® Forum Software