Hi all,
I would like to replace text in a Word template header, which is opened from MS Access.
I can open the file just fine...:
I can also access many properties of Word such as oApp.Selection. TypeText, but I cannot figure out how to replace text in the header of my word document with a variable declared in Access.
I know in Word, when recording the macro, it looks like this, but I can't get it to work in Access:
I would like to replace text in a Word template header, which is opened from MS Access.
I can open the file just fine...:
Code:
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:
Code:
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
Comment