我試圖弄清楚如何將插入TextBox
的值複製到Userform
中。我希望插入Userform
的所有值都保存在使用書籤的doc文件中。如何從Excel 2013中的Userform中將TextBox的值複製到使用書籤的doc文件中?
這裏是我的代碼:
Sub report()
Dim wrdApp As Word.Application
Set wrdApp = CreateObject("Word.Application")
With wrdApp
.documents.Open "C:\Users\ment_hoch.docx"
.Selection.GoTo What:=wdGoToBookmark, Name:="ab_name"
.Selection.TypeText text:=Me.TextBox1.text
'Not working
.Selection.GoTo What:=wdGoToBookmark, Name:="abteilung"
.Selection.TypeText text:=ComboBox1.Value
'Not working
End with
End Sub