[英]Changing a word document title with Textbox values
Im currently making a VBA userform with multiple textboxes. 我目前正在制作带有多个文本框的VBA用户窗体。 My goal is to make a macro enabled word template that pops up a userform on startup, containing multiple textboxes where the user can input values. 我的目标是制作一个启用宏的单词模板,该模板在启动时会弹出用户窗体,其中包含多个文本框,用户可以在其中输入值。
I was looking for a way to change the default save title of my word document. 我正在寻找一种方法来更改我的Word文档的默认保存标题。 I wanted to pass input values from textboxes into the title so that it would look something like this: 我想将输入值从文本框中传递到标题中,以便看起来像这样:
"Textbox1.Value_Textbox2.Value_Combobox1.Value_Textbox3.Value_....." (Space for the user to personalize the document name) “ Textbox1.Value_Textbox2.Value_Combobox1.Value_Textbox3.Value _.....”(用户用于个性化文档名称的空间)
The underscore seperation is very important. 下划线分隔非常重要。
I tried setting it with 我尝试用
'WORKS'
With Dialogs(wdDialogFileSummaryInfo)
.Title = TextBox7.Value
.Execute
End With
With the aim to combine all those textbox values into textbox 7 but i just cant get it to work. 为了将所有这些文本框值组合到文本框7中,但我无法使其正常工作。 Is there any other way to fix this issue? 还有其他方法可以解决此问题吗?
you may try this: 您可以尝试以下方法:
With Me
.TextBox7 = Join(Array(.TextBox1.Text, .TextBox2.Text, .ComboBox1.Value, .TextBox3.Text), "_") '<--| list your controls 'name.property' in the desired order
End With
With Dialogs(wdDialogFileSummaryInfo)
.Title = Me.TextBox7.Text
.Execute
End With
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.