calling a userform and reverting back

sassriverrat

Well-known Member
Joined
Oct 4, 2018
Messages
655
I have a section of code below from a much larger piece. The section of code worked when using an input box to acquire a userinput. However, I'd like to have userform replace the inputbox. I've tried just using a userform and inserting the line (as seen below) but that didn't work. I need the rest of the code below to call to the userform, allow the user to input data into textbox1, and then return to the lines of code being run.

thanks for the help

Code:
dim s as string

If s = "" then
'this works
s = inputbox("Please input here",vbokonly)

'I wish this worked instead
call userform17
s = userform17.textbox1.value
unload userform17

'rest of this section of working code
If s <> "" then 
blah blah blah
 
HEY! Worked like a champ there!!

thank you very much!!!

One last question-
how do I remove the msgbox that pops up that just says whatever was input?

Code:
Sub DemoTestDate()'First time initializing Code
Dim s As String
Dim name As String
Dim resp As Integer
Dim bdate As String
Dim ddate As String
name = Sheets("Notes").Range("N4")
bdate = Sheets("Developer").Range("A36")
ddate = Sheets("Developer").Range("C34")


s = GetSetting("DemoTest", "Registration", "Username")
If s = "" Then
        Sheets("Developer").Unprotect Password:=Worksheets("Developer").Range("B15:E15").Value
        Sheets("Developer").Range("B34:F34").ClearContents
        's = InputBox("Welcome to the " & namer & " Voyage Reporting System." & vbCrLf & "Please input the appropriate name to initialize the system for the first time." & vbCrLf & vbCrLf & "Note: this information can be modified later by clicking on the [Developer] button.", namer, "Bridge")
        'UserForm17.Show
        s = cInputBox()
        MsgBox s
        
        If s <> "" Then
            's = cInputBox()
            Sheets("Developer").Unprotect Password:=Worksheets("Developer").Range("B15:E15").Value
            Sheets("Developer").Range("B34") = s
            SaveSetting "DemoTest", "Registration", "Username", s
            Sheets("Notes").Visible = xlSheetVisible
            Sheets("Notes").Select
            Sheets("Developer").Range("C36") = Date
            'If s <> "" Then MsgBox "Welcome to the " & name & " Voyage Reporting System." & vbCrLf & "Please input the appropriate data to initialize the system for the first time." & vbCrLf & vbCrLf & "Note: this information can be modified later by clicking on the [Developer] button.", vbOKOnly, name
            Application.Visible = True
            Sheets("Developer").Protect Password:=Worksheets("Developer").Range("B15:E15").Value
        End If
End If
End Sub
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

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