VBA handler

bradgar

Board Regular
Joined
Aug 29, 2011
Messages
78
trying to have a userform run only once, long story, but for somereason my handler will not take me to the line i specify.

any ideas?

Rich (BB code):
Private Sub coInf1()                
Dim rF$, User$                               
Dim txt As String
 
txt = coInf.Txtbx.Value
User = Application.UserName
rF = ActiveWorkbook.Path & "-" & "8.Log"
 
If Dir(rF) = Empty Then
    coInf.Show
    If txt = "passsword" Then GoTo sLip
    Open rF For Output As #1
    Close #1
    ActiveWorkbook.Save
    MsgBox "Thank You for Registering!" & Chr(13) & Chr(13) & "This Product has now been officially Registered to " & Sheets("INPUT").Cells(2, 8).Value, vbExclamation, "Registration"

End If

sLip:
    Exit Sub

End Sub
seems straight forward enough...
 
How about this?

Open the form as soon as the form opens.

In the form's initialize event check for the file etc and if found unload the form.

If it's not found continue and display the form.

Then the user enters the password, clicks a button, the file is created and the form is unloaded.
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,224,598
Messages
6,179,822
Members
452,946
Latest member
JoseDavid

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