Hi all... I have 39 Excel user forms that I have created for people to fill out. I want them to be able to either save the forms in Word and/or print them out. I have a command button with code behind it for this. Is there a way to save all of the forms to a Word document? I found this code below and it works for creating the Word document and putting the word TEST in the file, but I do not know how to save my forms to Word. I want them to display as objects(I guess) so they do not lose their format. I am using Microsoft Visual Basic code to do this.
Thanks
Private Sub CmdPrintEntireApp_Click()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Add
With wrdDoc
For i = 1 To 39
FrmValue = FrmArray(i)
.Content.InsertAfter "TEST"
.Content.InsertParagraphAfter
Next i
If Dir("C:\MyDocs\MyNewWordDoc.doc") <> "" Then
Kill "C:\MyDocs\MyNewWordDoc.doc"
End If
.SaveAs ("C:\MyDocs\MyNewWordDoc.doc")
.Close ' close the document
End With
wrdApp.Quit ' close the Word application
Set wrdDoc = Nothing
Set wrdApp = Nothing
End Sub
Thanks
Private Sub CmdPrintEntireApp_Click()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Add
With wrdDoc
For i = 1 To 39
FrmValue = FrmArray(i)
.Content.InsertAfter "TEST"
.Content.InsertParagraphAfter
Next i
If Dir("C:\MyDocs\MyNewWordDoc.doc") <> "" Then
Kill "C:\MyDocs\MyNewWordDoc.doc"
End If
.SaveAs ("C:\MyDocs\MyNewWordDoc.doc")
.Close ' close the document
End With
wrdApp.Quit ' close the Word application
Set wrdDoc = Nothing
Set wrdApp = Nothing
End Sub