Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mail Merge Info

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I was wondering if anyone can lend a hand when it comes to merging from C# into word...let me explain:

We have a program embedded in word '97, that is a fax program (called bitware). What I basically need to do, is with a click of a command button read what values are in the text fields of the current form, export them to a text file, and then open word merging the text file to it. The code I used in Access was:

Function ExportAndMergeInfo(q)

Dim RetVal, o, a, p, f As String

o = Left(Environ("User"), 2)'InitialFirst, InitialLast
a = "C:\Program Files\Microsoft Office\Office\Winword.exe" 'Word97 application
p = "O:\CURRENT\FaxOut\" 'path
f = p & o & "InfoMerge.txt" 'filename

'Export the merge file
DoCmd.TransferText A_EXPORTDELIM, , q, f, True

'Open Word97 merge document
RetVal = Shell(a & " " & p & o & "info.doc", 3)

End Function

The text which is named using the leftenvirorment variable + InfoMerge...the text looks like:

'Info here is taken from textboxes on form (Macro)
Pb_fname","Pb_lname",Pb_phnum"
"John","Doe","","1 234-567-8989"

This text then gets merged into a word document called leftenvirorment variable + Info....

Arghhh...moving this over to C# has been killing me :-(

If anyone can help, I would be grateful...

-Joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top