View Full Version : Word Value to Excel offset value and print off

04-21-2008, 03:14 PM
Hi i was wondering if someone could help me i currently have a macro whereby
a userform will appear. I enter a number in the field on the user form and
click insert. This will then update the textfield in every page of my
document. Please see below what the macro is currently.
Sub Update()

Dim Title As String
Dim frmTitle As UserForm1
Dim oStory As Range

Set frmTitle = New UserForm1

With frmTitle
ActiveDocument.BuiltInDocumentProperties("Title").Value = .Title.Text
End With

Unload frmTitle

Set frmTitle = Nothing

For Each oStory In ActiveDocument.StoryRanges
If oStory.StoryType < wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
End If
Next oStory
Set oStory = Nothing
End Sub

What i want to do next is with the macro update having updated the Title field on the current document i then:
LookIn into an Excel file in a specified location. G:\Forms\ .Filename ="Index.xls"
In this Index.xls file i have a worksheet called index. Data is entered in columns A and B. Column A will have a list of documents name ie. 001250 while if you offset to the right of this cell a file name will appear with a .doc extension.
I want to find a match for Column A 001250, say it is called PrintFormA.doc in column B. This PrintFormA will be added to a path G:\Forms\PrintFormA.doc and open adding the Title Field into the textfield and printed off.

I am wondering if anyone could help me with this.