Writing Word VBA in VB 5.0 Professional Edition 
Author Message
 Writing Word VBA in VB 5.0 Professional Edition

I just got Visual Basic 5.0 Professional Edition.

I want to simply write VBA code that opens up a session of Microsoft
Word, adds a header/footer to the document, then modifies some menu
items.

How do I begin?????

If I don't have Office 97, can I still easily convert Word 6.0 macros to
VBA and run them through my Visual Basic 5.0 Professional Ed
application?


Thanks!
Robert



Sun, 23 Jan 2000 03:00:00 GMT  
 Writing Word VBA in VB 5.0 Professional Edition

Dim msword as Object
set msword = CreateObject("word.application")

' If you want to open a specific document

set curdoc = Documents.Open(filename:=Memdoc)

' memdoc would conatin the path and document name as in c:\MyDocs\test.doc
'if you get 429 erros you need to trap it and to a getobject above instead
of createobject

msword.application.visible = True

With msword
        .WindowState = wdWindowStateMaxSize
end with

Documents.(curdoc).Activate
' following is not a header you'll have to modify for that

set firstrange = ActiveDocument.Paragraphs(1).Range
ActiveDcoument.Words(1).Text = "This is what I want to say" & chr$(10)
with activedocument.Paragraphs(1).Range.Font
        .Name = "Arial"
        .Size = 16
        .Bold = True
End With
'etc etc

hope this helps

Chuck


Quote:
> I just got Visual Basic 5.0 Professional Edition.

> I want to simply write VBA code that opens up a session of Microsoft
> Word, adds a header/footer to the document, then modifies some menu
> items.

> How do I begin?????

> If I don't have Office 97, can I still easily convert Word 6.0 macros to
> VBA and run them through my Visual Basic 5.0 Professional Ed
> application?


> Thanks!
> Robert



Thu, 27 Jan 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VB 5.0 Professional Edition Vs. VB 5.0 Enterprise Edition

2. VB 5.0 Professional edition does it support ?

3. Seeking VB 5.0 Professional Edition

4. Installing VB 5.0 Professional Edition

5. VB Enterprise Edition vs. Professional Edition

6. Visual Basic 5.0 Professional Edition and ADO 2.0

7. need visual C++ 5.0 Professional Edition

8. Display network neighborhood in Visual Basic 5.0 Professional Edition

9. Visual Basic 5.0 Professional Edition and ADO 2.0

10. Visual Basic 5.0 Professional Edition

11. Wanted Visual Basic 5.0 Professional Edition

12. Visual Basic 5.0 Professional Edition

 

 
Powered by phpBB® Forum Software