Some Users get VBA error 91 after call Userform with TextBox related to sheet

platypus007

New Member
Joined
Oct 24, 2019
Messages
19
Office Version
  1. 2016
Platform
  1. Windows
Hi, I have this problem with code on some PCs (Error 91). Code is used to give user splash screen after start of workbook - where is classical EULA conditions located with button Accept and Decline. I have problems to call Sheet named EULA, which have the text for the Userform TextBox. Where I go wrong?

VBA Code:
Dim txt As String
Dim TextBox1 As Shape
ThisWorkbook.Sheets("EULA").Select
txt = Range("B2").Value & vbNewLine & Range("B3").Value & vbNewLine & Range("B4").Value & vbNewLine & Range("B5").Value & vbNewLine & Range("B6").Value & vbNewLine _
    & Range("B7").Value & vbNewLine & Range("B8").Value & vbNewLine & Range("B9").Value     
Me.TextBox1.Text = txt
Me.TextBox1.SetFocus
Me.TextBox1.CurLine = 0
ThisWorkbook.Sheets("DTD_OVERVIEW").Select

Can you help me?
Thanks
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
This line makes no sense:
VBA Code:
Dim TextBox1 As Shape

Also, no need to select the sheet with the text. Try this:

VBA Code:
With ThisWorkbook.Sheets("EULA")
    txt = .Range("B2").Value & vbNewLine & .Range("B3").Value & vbNewLine & .Range("B4").Value & vbNewLine & .Range("B5").Value & vbNewLine & .Range("B6").Value & vbNewLine _
        & .Range("B7").Value & vbNewLine & .Range("B8").Value & vbNewLine & .Range("B9").Value     
End With
Me.TextBox1.Text = txt

And what I would do is put the whole message, line breaks and all, into one cell.
 
Upvote 0

Forum statistics

Threads
1,215,575
Messages
6,125,618
Members
449,238
Latest member
wcbyers

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top