J
John
Hi
I am still having trouble with this function, I want to take data from a
text boxes and import it in to word, I can call a new document but have
failed to transfer the data, please help
Below is what i got so far. I have tried it different ways and am now
getting confused.
Please try to include an example.
Thanks
Option Explicit
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Public Function Print_to_Word()
' Dim wrdSelection As Word.Selection
' Dim wrdMailMerge As Word.MailMerge
Dim wrdMergeFields As Word.MailMergeFields
Dim Bk As Word.Bookmark
' On Error GoTo Error_Handler
Screen.MousePointer = vbHourglass
' Create an instance of Word and make it visible
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
' Add a new document
Set wrdDoc = wrdApp.Documents.Add
wrdDoc.Select
' Set wrdSelection = wrdApp.Selection
' Set wrdMailMerge = wrdDoc.MailMerge
For Each Bk In wrdDoc.Bookmarks
Select Case Bk.Name
Case "Salutation"
Bk.Range.Text = Clients.txtFields(0).Text
Case "WhatToSend"
Bk.Range.Text = "Xxxxxxxxxxxxxxxx"
End Select
Next
Screen.MousePointer = vbDefault
End Function
I am still having trouble with this function, I want to take data from a
text boxes and import it in to word, I can call a new document but have
failed to transfer the data, please help
Below is what i got so far. I have tried it different ways and am now
getting confused.
Please try to include an example.
Thanks
Option Explicit
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Public Function Print_to_Word()
' Dim wrdSelection As Word.Selection
' Dim wrdMailMerge As Word.MailMerge
Dim wrdMergeFields As Word.MailMergeFields
Dim Bk As Word.Bookmark
' On Error GoTo Error_Handler
Screen.MousePointer = vbHourglass
' Create an instance of Word and make it visible
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
' Add a new document
Set wrdDoc = wrdApp.Documents.Add
wrdDoc.Select
' Set wrdSelection = wrdApp.Selection
' Set wrdMailMerge = wrdDoc.MailMerge
For Each Bk In wrdDoc.Bookmarks
Select Case Bk.Name
Case "Salutation"
Bk.Range.Text = Clients.txtFields(0).Text
Case "WhatToSend"
Bk.Range.Text = "Xxxxxxxxxxxxxxxx"
End Select
Next
Screen.MousePointer = vbDefault
End Function