解释vba代码如何打印确认信 [英] explain how vba code prints confirmation letters

查看:114
本文介绍了解释vba代码如何打印确认信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Private Sub Command38_Click()

Dim Wrd As Word.Application

设置Wrd = CreateObject(Word.Application)



Dim模板字符串

template = Application.CurrentProject.Path&\ Template.docx



Wrd.Documents.Add模板

Wrd.Visible = True



使用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

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

推荐答案

你有什么想法吗?逐行解释代码的工作是什么?

每一行都需要一段解释!例如:

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]()



创建一个名为nextRand的新变量,它可以包含整数值。从先前声明的Random实例r,调用Next方法获取一个新的随机数,并将其分配给nextRand变量。



可以你想象我们需要多长时间才能解释一个像你的例子一样的非常短的代码片段,一行一行?



不会发生这种情况。如果您有特定问题,请询问有关它的问题。但首先考虑一下 - 您是否希望坐下45分钟并且没有充分的理由输入逐行描述?


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?


这篇关于解释vba代码如何打印确认信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆