Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
AutoRun Macro with a delay to give user the choice to cancel the macro | Excel Programming | |||
Need syntax for RUNning a Word macro with an argument, called from an Excel macro | Excel Programming | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |