I would like to replace text in a Word template header, which is opened from MS Access.
I can open the file just fine...:
Expand|Select|Wrap|Line Numbers
- Set oApp = CreateObject("Word.Application")
- oApp.Visible = True
- Set doc = oApp.Documents.Add(Template:="C:\CL_Template.dotx", NewTemplate:=False, DocumentType:=0)
I know in Word, when recording the macro, it looks like this, but I can't get it to work in Access:
Expand|Select|Wrap|Line Numbers
- Dim myStoryRange As Range
- For Each myStoryRange In ActiveDocument.StoryRanges
- With myStoryRange.Find
- .Text = "Letterdate"
- .Replacement.Text = let_date_var
- .Wrap = wdFindContinue
- .Execute Replace:=wdReplaceAll
- End With
- Next myStoryRange