
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