Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2008

Tip: Looking for answers? Try searching our database.

automating (alt & f11)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
pswanie - 20 Jan 2008 10:45 GMT
my previous posting was not clear i think...

what can i add to a command so that when i click it, it checks that textbox1
got "mypass" and then run the sub

i have a textbox on a userform and a commandbutton1.
the aplication (excell workbook) is set to visible = valse

click commandbutton1 go and check if textbox1 contain "mypass"
commandbutton1 make the application visible = true and unload userform1.

then i can get to my macros etc..
i got this.

Private Sub CommandButton5_Click()

Application.Visible = True
Unload UserForm1

End Sub
Per Jessen - 20 Jan 2008 10:55 GMT
I think this is what you need.

Private Sub CommandButton5_Click()

If Me.textbox1.Value = "mypass" Then
   Application.Visible = True
   Unload UserForm1
End If

End Sub

//Per

> my previous posting was not clear i think...
>
[quoted text clipped - 17 lines]
>
> End Sub
Rick Rothstein (MVP - VB) - 20 Jan 2008 10:59 GMT
Try this...

Private Sub CommandButton5_Click()
   If TextBox1.Text = "mypass" Then
       Application.Visible = True
       Unload UserForm1
   End If
End Sub

If you are doing what I think you are doing, you should know (at least I'm
pretty sure that) your password will be embedded in the saved workbook as
plain text; viewable with a plain text editor like Notepad. True, someone
would have to know where to look, but it might be easy to locate. You might
want to encrypt it a little bit to make it harder to find. One way, perhaps,
would be to mix it in between other characters (maybe locating each letter
as the 3rd character in a much bigger string of characters) and run a loop
to pick them out.

Rick

> my previous posting was not clear i think...
>
[quoted text clipped - 17 lines]
>
> End Sub
pswanie - 20 Jan 2008 11:08 GMT
great idea....  jip im aware that its easy to crack that..

how would i go about to use that loop idea?

> Try this...
>
[quoted text clipped - 37 lines]
> >
> > End Sub
Rick Rothstein (MVP - VB) - 20 Jan 2008 16:56 GMT
Try this (the password is still mypass)...

Private Sub CommandButton5_Click()
   Dim X As Long
   Dim PW As String
   Const HiddenPassword = "@32m )#yeX*p p!a64bs ##sdf2"
   For X = 4 To Len(HiddenPassword) Step 4
     PW = PW & Mid(HiddenPassword, X, 1)
   Next
   If TextBox1.Text = PW Then
       Application.Visible = True
       Unload UserForm1
   End If
End Sub

You can change the starting spot in for you password in the HiddenPassword
constant, and also vary the number of characters between the letters of your
password, you just have to adjust the starting point and Step values in the
For-Next loop. This way, if someone looks, they will only see @32m )#yeX*p
p!a64bs ##sdf2 and not your actual password. Of course, this is an extremely
simple encryption scheme, but it should suffice for normal situations. Note
that if you use a regular word or phrase, it might still be discoverable by
"prying eyes", but if you mix punctuation marks into your "real" password,
it should be harder to find in random mix of letters.

Rick

> great idea....  jip im aware that its easy to crack that..
>
[quoted text clipped - 47 lines]
>> >
>> > End Sub
pswanie - 20 Jan 2008 11:10 GMT
i needed to add that when userform unload and application vissible hapens.
would it be possible to automate the alt & F11 keystroke?

> my previous posting was not clear i think...
>
[quoted text clipped - 16 lines]
>
> End Sub
Rick Rothstein (MVP - VB) - 20 Jan 2008 17:19 GMT
Put this right after your "Unload UserForm1" statement...

    Application.OnKey "%{F11}"

Rick

>i needed to add that when userform unload and application vissible hapens.
> would it be possible to automate the alt & F11 keystroke?
[quoted text clipped - 20 lines]
>>
>> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.