D
Dale G
Hi does anyone know how I would transfer data to my word template from a sub
form that is on my main form?
I’m able to receive the main form data using this code, behind a button.
Dim oWord As New Word.Application
With oWord
.Documents.Add "C:\Documents and Settings\Employee Details.dot"
.Selection.GoTo wdGoToBookmark, , , "bmkEmployeePhoto"
.Selection.InlineShapes.AddPicture FileName:= _
Me.ImagePath, LinkToFile:=False
.Selection.GoTo wdGoToBookmark, , , "bmkEmployeeFirstName"
.Selection.TypeText Me.FirstName
.Selection.GoTo wdGoToBookmark, , , "bmkEmployeeLastName"
.Selection.TypeText Me.LastName
.Selection.GoTo wdGoToBookmark, , , "bmkEmployeeStreet"
.Selection.TypeText Me.Address
.Selection.GoTo wdGoToBookmark, , , "bmkEmployeeCity"
.Selection.TypeText Me.City
I’ve tried;
..Selection.GoTo wdGoToBookmark, , , "bmkEmergencyContactName"
..Selection.TypeText
[Forms]![fsubEmployeeDetails2][Me.EmergencyContactFirstName]
But this does not work. Any help is appreciated.
form that is on my main form?
I’m able to receive the main form data using this code, behind a button.
Dim oWord As New Word.Application
With oWord
.Documents.Add "C:\Documents and Settings\Employee Details.dot"
.Selection.GoTo wdGoToBookmark, , , "bmkEmployeePhoto"
.Selection.InlineShapes.AddPicture FileName:= _
Me.ImagePath, LinkToFile:=False
.Selection.GoTo wdGoToBookmark, , , "bmkEmployeeFirstName"
.Selection.TypeText Me.FirstName
.Selection.GoTo wdGoToBookmark, , , "bmkEmployeeLastName"
.Selection.TypeText Me.LastName
.Selection.GoTo wdGoToBookmark, , , "bmkEmployeeStreet"
.Selection.TypeText Me.Address
.Selection.GoTo wdGoToBookmark, , , "bmkEmployeeCity"
.Selection.TypeText Me.City
I’ve tried;
..Selection.GoTo wdGoToBookmark, , , "bmkEmergencyContactName"
..Selection.TypeText
[Forms]![fsubEmployeeDetails2][Me.EmergencyContactFirstName]
But this does not work. Any help is appreciated.