Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: (untagged)
Private Sub Command38_Click()
Dim Wrd As Word.Application
Set Wrd = CreateObject("Word.Application")

Dim template As String
template = Application.CurrentProject.Path & "\Template.docx"

Wrd.Documents.Add template
Wrd.Visible = True

With Wrd.ActiveDocument.Bookmarks
.Item("Date").Range.Text = VBA.Date
.Item("FName").Range.Text = Customer_First_Name
.Item("LName").Range.Text = Customer_Last_Name
.Item("Add1").Range.Text = First_Line_of_Address
.Item("Add2").Range.Text = Second_Line_of_Address
.Item("Town").Range.Text = Town
.Item("PCode").Range.Text = Post_Code
.Item("CName").Range.Text = Customer_First_Name
Posted

1 solution

Do you have any idea how much work explaining code line by line is?
Every single line needs a paragraph of explanation! For example:
Dim nextRand As Integer = r.[Next]()

Create a new variable called "nextRand" which can hold a integer value. From the previously declared Random instance "r", call the "Next" method to get a new random number, and assign it to the "nextRand" variable.

Can you imagine how long it would take us to explain even a very short code fragment like your example, line by line?

No. It is not going to happen. If you have a specific problem, then ask a question about it. But think first - would you want to sit down for 45 minutes and type up a line-by-line description for no good reason?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900