Excel 2007 Forms to Print or Word

LBissett

New Member
Joined
Apr 10, 2009
Messages
22
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
 

Some videos you may like

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Watch MrExcel Video

Forum statistics

Threads
1,122,469
Messages
5,596,329
Members
414,055
Latest member
mcarduner

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top