Hello.
I have an Excel sheet named DATA and a text button with the word "TEST".
I want to assign a macro to that text button that opens a open file dialog, collect the the file name and replace the word "TEST" with the file name.
I've tried this:
It doesn't work.
I'm able to collect the file but then it returns
"Run time error '91'
Object variable or with BLock not set"
The error is here:
What am I missing?
THX!
Rui
I have an Excel sheet named DATA and a text button with the word "TEST".
I want to assign a macro to that text button that opens a open file dialog, collect the the file name and replace the word "TEST" with the file name.
I've tried this:
Sub TextBox4_Click()
Dim sFileName As String
Dim TextBox4 As TextBox
sFileName = Application.GetOpenFilename("MS Excel (*.xlsx), *.xls")
TextBox4.Text = sFileName
End Sub
It doesn't work.
I'm able to collect the file but then it returns
"Run time error '91'
Object variable or with BLock not set"
The error is here:
TextBox4.Text = sFileName
What am I missing?
THX!
Rui