保存文本框值,VBA,Excel

我正在写一个Excel的代码,这将有一个forms女巫包括一个文本框和button。 buttonselect一个文件夹目录并将其写入文本框中。 部分forms是这个!

屏幕截图

代码是这样的

Private Sub CommandButton1_Click() Dim diaFolder As FileDialog On Error GoTo ErrorHandler Set diaFolder = Application.FileDialog(msoFileDialogFolderPicker) diaFolder.AllowMultiSelect = False diaFolder.Title = "Select a folder then hit OK" diaFolder.Show TextBox1.Text = diaFolder.SelectedItems(1) Set diaFolder = Nothing Exit Sub ErrorHandler: Msg = "No folder selected, you must select a folder for program to run" Style = vbError Title = "Need to Select Folder" Response = MsgBox(Msg, Style, Title) End Sub 

问题是如何保存“文本框”值来显示它,每次我调用用户窗体; 它不应该依赖于工作簿中的单元格,因为它将是一个加载项,并将从function区button调用。

任何想法将非常感激! 谢谢。