Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default alt & f11 via macro

i got this.

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

and in that sub add a command to go to the editor ("alt" & "f11")



Private Sub CommandButton5_Click()


Application.Visible = True
Unload UserForm1


End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default alt & f11 via macro

Hello,

Try this:

Sub test()

' Get text box
ActiveSheet.Shapes("Text Box 1").Select

If Selection.Characters.Text = "MyPass" Then
' run sub

' Show VBE window
Application.VBE.ActiveCodePane.Show
End If

' Deselect text box
ActiveCell.Activate

End Sub

HTH,
Matthew Pfluger

"pswanie" wrote:

i got this.

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

and in that sub add a command to go to the editor ("alt" & "f11")



Private Sub CommandButton5_Click()


Application.Visible = True
Unload UserForm1


End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default alt & f11 via macro

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

now if i enter "mypass" in the textbox it enable commandbutton1.

commandbutton1_click make the application visible = true and unload userform1.

then i can get to my macros etc..


"Matthew Pfluger" wrote:

Hello,

Try this:

Sub test()

' Get text box
ActiveSheet.Shapes("Text Box 1").Select

If Selection.Characters.Text = "MyPass" Then
' run sub

' Show VBE window
Application.VBE.ActiveCodePane.Show
End If

' Deselect text box
ActiveCell.Activate

End Sub

HTH,
Matthew Pfluger

"pswanie" wrote:

i got this.

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

and in that sub add a command to go to the editor ("alt" & "f11")



Private Sub CommandButton5_Click()


Application.Visible = True
Unload UserForm1


End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default alt & f11 via macro

Okay, then change this:

ActiveSheet.Shapes("Text Box 1").Select
If Selection.Characters.Text = "MyPass" Then

to

If Me.TextBox1.Text = "MyPass" Then

Does that work for you?
Matthew Pfluger

"pswanie" wrote:

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

now if i enter "mypass" in the textbox it enable commandbutton1.

commandbutton1_click make the application visible = true and unload userform1.

then i can get to my macros etc..



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default alt & f11 via macro

jip...
thanx (i did repost. didnt know if u got it flaged for notify of replies...)

do u know how to get the (alt & F11) key stroke by code in that?

if pass = my pass
then alt & f11 key stroke and rest of code


"Matthew Pfluger" wrote:

Okay, then change this:

ActiveSheet.Shapes("Text Box 1").Select
If Selection.Characters.Text = "MyPass" Then

to

If Me.TextBox1.Text = "MyPass" Then

Does that work for you?
Matthew Pfluger

"pswanie" wrote:

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

now if i enter "mypass" in the textbox it enable commandbutton1.

commandbutton1_click make the application visible = true and unload userform1.

then i can get to my macros etc..





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default alt & f11 via macro

pswanie,

In my original post, the code:

Application.VBE.ActiveCodePane.Show

will do the same thing as Alt+F11. You can also use the SendKeys method:

Application.SendKeys ("%{F11}") where % stands for ALT. See the help files.

Matthew Pfluger

"pswanie" wrote:

jip...
thanx (i did repost. didnt know if u got it flaged for notify of replies...)

do u know how to get the (alt & F11) key stroke by code in that?

if pass = my pass
then alt & f11 key stroke and rest of code


"Matthew Pfluger" wrote:

Okay, then change this:

ActiveSheet.Shapes("Text Box 1").Select
If Selection.Characters.Text = "MyPass" Then

to

If Me.TextBox1.Text = "MyPass" Then

Does that work for you?
Matthew Pfluger

"pswanie" wrote:

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

now if i enter "mypass" in the textbox it enable commandbutton1.

commandbutton1_click make the application visible = true and unload userform1.

then i can get to my macros etc..



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default alt & f11 via macro

run-time error '1004'
programmatic access to visual basic project is not trusted

i dont have a password on my codes (tools, vba properties, protection) but
might use one later

and the other way just open the worksheet like normal not the code side




"Matthew Pfluger" wrote:

pswanie,

In my original post, the code:

Application.VBE.ActiveCodePane.Show

will do the same thing as Alt+F11. You can also use the SendKeys method:

Application.SendKeys ("%{F11}") where % stands for ALT. See the help files.

Matthew Pfluger

"pswanie" wrote:

jip...
thanx (i did repost. didnt know if u got it flaged for notify of replies...)

do u know how to get the (alt & F11) key stroke by code in that?

if pass = my pass
then alt & f11 key stroke and rest of code


"Matthew Pfluger" wrote:

Okay, then change this:

ActiveSheet.Shapes("Text Box 1").Select
If Selection.Characters.Text = "MyPass" Then

to

If Me.TextBox1.Text = "MyPass" Then

Does that work for you?
Matthew Pfluger

"pswanie" wrote:

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

now if i enter "mypass" in the textbox it enable commandbutton1.

commandbutton1_click make the application visible = true and unload userform1.

then i can get to my macros etc..



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default alt & f11 via macro

Ah, sorry about that security setting. You will need to go to
Tools--Macro--Security and go to the Trusted Publishers tab and check the
two checkboxes at the bottom of the form. That should solve your problem.

Matthew Pfluger

"pswanie" wrote:

run-time error '1004'
programmatic access to visual basic project is not trusted

i dont have a password on my codes (tools, vba properties, protection) but
might use one later

and the other way just open the worksheet like normal not the code side




"Matthew Pfluger" wrote:

pswanie,

In my original post, the code:

Application.VBE.ActiveCodePane.Show

will do the same thing as Alt+F11. You can also use the SendKeys method:

Application.SendKeys ("%{F11}") where % stands for ALT. See the help files.

Matthew Pfluger

"pswanie" wrote:

jip...
thanx (i did repost. didnt know if u got it flaged for notify of replies...)

do u know how to get the (alt & F11) key stroke by code in that?

if pass = my pass
then alt & f11 key stroke and rest of code


"Matthew Pfluger" wrote:

Okay, then change this:

ActiveSheet.Shapes("Text Box 1").Select
If Selection.Characters.Text = "MyPass" Then

to

If Me.TextBox1.Text = "MyPass" Then

Does that work for you?
Matthew Pfluger

"pswanie" wrote:

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

now if i enter "mypass" in the textbox it enable commandbutton1.

commandbutton1_click make the application visible = true and unload userform1.

then i can get to my macros etc..



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default alt & f11 via macro

tun-time error '91'

object variable or with block cariable not set

"Matthew Pfluger" wrote:

Ah, sorry about that security setting. You will need to go to
Tools--Macro--Security and go to the Trusted Publishers tab and check the
two checkboxes at the bottom of the form. That should solve your problem.

Matthew Pfluger

"pswanie" wrote:

run-time error '1004'
programmatic access to visual basic project is not trusted

i dont have a password on my codes (tools, vba properties, protection) but
might use one later

and the other way just open the worksheet like normal not the code side




"Matthew Pfluger" wrote:

pswanie,

In my original post, the code:

Application.VBE.ActiveCodePane.Show

will do the same thing as Alt+F11. You can also use the SendKeys method:

Application.SendKeys ("%{F11}") where % stands for ALT. See the help files.

Matthew Pfluger

"pswanie" wrote:

jip...
thanx (i did repost. didnt know if u got it flaged for notify of replies...)

do u know how to get the (alt & F11) key stroke by code in that?

if pass = my pass
then alt & f11 key stroke and rest of code


"Matthew Pfluger" wrote:

Okay, then change this:

ActiveSheet.Shapes("Text Box 1").Select
If Selection.Characters.Text = "MyPass" Then

to

If Me.TextBox1.Text = "MyPass" Then

Does that work for you?
Matthew Pfluger

"pswanie" wrote:

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

now if i enter "mypass" in the textbox it enable commandbutton1.

commandbutton1_click make the application visible = true and unload userform1.

then i can get to my macros etc..



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default alt & f11 via macro

Hmm, not sure why that is. Can you try this ultra-simple macro below? With
those two security settings checked, you shouldn't have any problems with
this. Otherwise, I'm not sure.

Sub test()
Application.VBE.ActiveCodePane.Show
End Sub

Matthew Pfluger


  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default alt & f11 via macro

i used a "clean" workbook and it worked...

will have a look and play around

much appreciated!!!!

thanx

Phillip

"Matthew Pfluger" wrote:

Hmm, not sure why that is. Can you try this ultra-simple macro below? With
those two security settings checked, you shouldn't have any problems with
this. Otherwise, I'm not sure.

Sub test()
Application.VBE.ActiveCodePane.Show
End Sub

Matthew Pfluger

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default alt & f11 via macro

this is what i got and what im using...

i tried moving that one line up/down but with no luck. somewhere it said
something about a with. but that did not work either

Private Sub CommandButton5_Click()

If Me.TextBox55.Value = "b" Then

Application.Visible = True
Application.VBE.ActiveCodePane.Show
Unload UserForm1

Else


MsgBox " This part is restricted" & vbNewLine & _
"Password required/Invalid Password" & vbNewLine & vbNewLine
& _
" Please retry"
End If

End Sub



  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default alt & f11 via macro

Are you missing an "End if"?

"pswanie" wrote:

this is what i got and what im using...

i tried moving that one line up/down but with no luck. somewhere it said
something about a with. but that did not work either

Private Sub CommandButton5_Click()

If Me.TextBox55.Value = "b" Then

Application.Visible = True
Application.VBE.ActiveCodePane.Show
Unload UserForm1

Else


MsgBox " This part is restricted" & vbNewLine & _
"Password required/Invalid Password" & vbNewLine & vbNewLine
& _
" Please retry"
End If

End Sub



  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default alt & f11 via macro

wait.... i think it does not set focus to the worksheet when i get to unload
userform1. how would i "select/set focus" to my worksheet after that line.

then application.vbe etc

"Matthew Pfluger" wrote:

Are you missing an "End if"?

"pswanie" wrote:

this is what i got and what im using...

i tried moving that one line up/down but with no luck. somewhere it said
something about a with. but that did not work either

Private Sub CommandButton5_Click()

If Me.TextBox55.Value = "b" Then

Application.Visible = True
Application.VBE.ActiveCodePane.Show
Unload UserForm1

Else


MsgBox " This part is restricted" & vbNewLine & _
"Password required/Invalid Password" & vbNewLine & vbNewLine
& _
" Please retry"
End If

End Sub



  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default alt & f11 via macro

Application.ScreenUpdating = True
ThisWorkbook.Sheets("SheetName").Activate

That may solve your problem, but I'm not sure. You shouldn't have to set
focus to the worksheet before activating the VBE.

Matthew Pfluger

"pswanie" wrote:

wait.... i think it does not set focus to the worksheet when i get to unload
userform1. how would i "select/set focus" to my worksheet after that line.

then application.vbe etc

"Matthew Pfluger" wrote:

Are you missing an "End if"?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
AutoRun Macro with a delay to give user the choice to cancel the macro wanderlust Excel Programming 2 September 28th 07 04:09 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 10:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"