Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
SendKeys "%{F11}", True
Hi All,
I tried to use (in XL2003) SendKeys "%{F11}", True to open VBE window, but it had no effect. In fact my real aim was SendKeys "%{F11}%TE+{TAB}{RIGHT}%V{+}{TAB}" & Password & "{TAB}" & Password & "~%{F11}", True to set VBA project password. I found out that "%{F11}" part doesn't work. If I previously open VBE window manually with Alt+F11, the remaining part sets the password. Any advice? Thanks, Stefi |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
SendKeys "%{F11}", True
Stefi,
Try code like: Sub OpenVBProject(WB As Workbook) Dim VBProj As Object Dim N As Long N = 0 With Application.VBE .MainWindow.Visible = True For Each VBProj In .VBProjects N = N + 1 If VBProj.Filename = WB.FullName Then Set .ActiveVBProject = .VBProjects(N) SendKeys "{ENTER}" SendKeys "aa" '<<< YOUR PASSWORD SendKeys "{ENTER}" Exit For End If End With Next VBProj End Sub You call this from a procedure as: OpenVBProject Workbooks("Book123.xls") -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Hi All, I tried to use (in XL2003) SendKeys "%{F11}", True to open VBE window, but it had no effect. In fact my real aim was SendKeys "%{F11}%TE+{TAB}{RIGHT}%V{+}{TAB}" & Password & "{TAB}" & Password & "~%{F11}", True to set VBA project password. I found out that "%{F11}" part doesn't work. If I previously open VBE window manually with Alt+F11, the remaining part sets the password. Any advice? Thanks, Stefi |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
SendKeys "%{F11}", True
Thanks Chip, I immediately start testing, I'll post the result'
Stefi €˛Chip Pearson€¯ ezt Ć*rta: Stefi, Try code like: Sub OpenVBProject(WB As Workbook) Dim VBProj As Object Dim N As Long N = 0 With Application.VBE .MainWindow.Visible = True For Each VBProj In .VBProjects N = N + 1 If VBProj.Filename = WB.FullName Then Set .ActiveVBProject = .VBProjects(N) SendKeys "{ENTER}" SendKeys "aa" '<<< YOUR PASSWORD SendKeys "{ENTER}" Exit For End If End With Next VBProj End Sub You call this from a procedure as: OpenVBProject Workbooks("Book123.xls") -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Hi All, I tried to use (in XL2003) SendKeys "%{F11}", True to open VBE window, but it had no effect. In fact my real aim was SendKeys "%{F11}%TE+{TAB}{RIGHT}%V{+}{TAB}" & Password & "{TAB}" & Password & "~%{F11}", True to set VBA project password. I found out that "%{F11}" part doesn't work. If I previously open VBE window manually with Alt+F11, the remaining part sets the password. Any advice? Thanks, Stefi |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
SendKeys "%{F11}", True
Hi Chip,
I found that this form works: Sub OpenVBProject(WB As Workbook) Dim VBProj As Object Dim N As Long N = 0 Password = "test" With Application.VBE .MainWindow.Visible = True For Each VBProj In .VBProjects N = N + 1 If VBProj.Filename = WB.FullName Then Set .ActiveVBProject = .VBProjects(N) SendKeys "%TE+{TAB}{RIGHT}%V{TAB}" & Password & "{TAB}" & Password & "~", True Exit For End If Next VBProj .MainWindow.Visible = False End With End Sub There is a minor question remained: I couldn't make it work when started OpenVBProject via a hot key (say Ctrl+t). Do you have any explanation? Many thanks anyway! Regards, Stefi €˛Chip Pearson€¯ ezt Ć*rta: Stefi, Try code like: Sub OpenVBProject(WB As Workbook) Dim VBProj As Object Dim N As Long N = 0 With Application.VBE .MainWindow.Visible = True For Each VBProj In .VBProjects N = N + 1 If VBProj.Filename = WB.FullName Then Set .ActiveVBProject = .VBProjects(N) SendKeys "{ENTER}" SendKeys "aa" '<<< YOUR PASSWORD SendKeys "{ENTER}" Exit For End If End With Next VBProj End Sub You call this from a procedure as: OpenVBProject Workbooks("Book123.xls") -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Hi All, I tried to use (in XL2003) SendKeys "%{F11}", True to open VBE window, but it had no effect. In fact my real aim was SendKeys "%{F11}%TE+{TAB}{RIGHT}%V{+}{TAB}" & Password & "{TAB}" & Password & "~%{F11}", True to set VBA project password. I found out that "%{F11}" part doesn't work. If I previously open VBE window manually with Alt+F11, the remaining part sets the password. Any advice? Thanks, Stefi |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
SendKeys "%{F11}", True
Do you have any explanation? Nothing beyond that SendKeys is very unreliable. I would never use it in commercial code. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Hi Chip, I found that this form works: Sub OpenVBProject(WB As Workbook) Dim VBProj As Object Dim N As Long N = 0 Password = "test" With Application.VBE .MainWindow.Visible = True For Each VBProj In .VBProjects N = N + 1 If VBProj.Filename = WB.FullName Then Set .ActiveVBProject = .VBProjects(N) SendKeys "%TE+{TAB}{RIGHT}%V{TAB}" & Password & "{TAB}" & Password & "~", True Exit For End If Next VBProj .MainWindow.Visible = False End With End Sub There is a minor question remained: I couldn't make it work when started OpenVBProject via a hot key (say Ctrl+t). Do you have any explanation? Many thanks anyway! Regards, Stefi €˛Chip Pearson€¯ ezt Ć*rta: Stefi, Try code like: Sub OpenVBProject(WB As Workbook) Dim VBProj As Object Dim N As Long N = 0 With Application.VBE .MainWindow.Visible = True For Each VBProj In .VBProjects N = N + 1 If VBProj.Filename = WB.FullName Then Set .ActiveVBProject = .VBProjects(N) SendKeys "{ENTER}" SendKeys "aa" '<<< YOUR PASSWORD SendKeys "{ENTER}" Exit For End If End With Next VBProj End Sub You call this from a procedure as: OpenVBProject Workbooks("Book123.xls") -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Hi All, I tried to use (in XL2003) SendKeys "%{F11}", True to open VBE window, but it had no effect. In fact my real aim was SendKeys "%{F11}%TE+{TAB}{RIGHT}%V{+}{TAB}" & Password & "{TAB}" & Password & "~%{F11}", True to set VBA project password. I found out that "%{F11}" part doesn't work. If I previously open VBE window manually with Alt+F11, the remaining part sets the password. Any advice? Thanks, Stefi |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
SendKeys "%{F11}", True
Well, I made it work via a Commandbutton. I would negligate using Sendkeys
with pleasure, but how else could I achieve my aim (setting VBA project password)? Thanks for your assistance! Best regards, Stefi €˛Chip Pearson€¯ ezt Ć*rta: Do you have any explanation? Nothing beyond that SendKeys is very unreliable. I would never use it in commercial code. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Hi Chip, I found that this form works: Sub OpenVBProject(WB As Workbook) Dim VBProj As Object Dim N As Long N = 0 Password = "test" With Application.VBE .MainWindow.Visible = True For Each VBProj In .VBProjects N = N + 1 If VBProj.Filename = WB.FullName Then Set .ActiveVBProject = .VBProjects(N) SendKeys "%TE+{TAB}{RIGHT}%V{TAB}" & Password & "{TAB}" & Password & "~", True Exit For End If Next VBProj .MainWindow.Visible = False End With End Sub There is a minor question remained: I couldn't make it work when started OpenVBProject via a hot key (say Ctrl+t). Do you have any explanation? Many thanks anyway! Regards, Stefi €˛Chip Pearson€¯ ezt Ć*rta: Stefi, Try code like: Sub OpenVBProject(WB As Workbook) Dim VBProj As Object Dim N As Long N = 0 With Application.VBE .MainWindow.Visible = True For Each VBProj In .VBProjects N = N + 1 If VBProj.Filename = WB.FullName Then Set .ActiveVBProject = .VBProjects(N) SendKeys "{ENTER}" SendKeys "aa" '<<< YOUR PASSWORD SendKeys "{ENTER}" Exit For End If End With Next VBProj End Sub You call this from a procedure as: OpenVBProject Workbooks("Book123.xls") -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Hi All, I tried to use (in XL2003) SendKeys "%{F11}", True to open VBE window, but it had no effect. In fact my real aim was SendKeys "%{F11}%TE+{TAB}{RIGHT}%V{+}{TAB}" & Password & "{TAB}" & Password & "~%{F11}", True to set VBA project password. I found out that "%{F11}" part doesn't work. If I previously open VBE window manually with Alt+F11, the remaining part sets the password. Any advice? Thanks, Stefi |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
SendKeys "%{F11}", True
Unfortunately, there is no programmatic way to modify the security settings
of a VBProject. You can test the setting but not unlock the project. SendKeys, as poor as it is, is the only way to do it. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Well, I made it work via a Commandbutton. I would negligate using Sendkeys with pleasure, but how else could I achieve my aim (setting VBA project password)? Thanks for your assistance! Best regards, Stefi €˛Chip Pearson€¯ ezt Ć*rta: Do you have any explanation? Nothing beyond that SendKeys is very unreliable. I would never use it in commercial code. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Hi Chip, I found that this form works: Sub OpenVBProject(WB As Workbook) Dim VBProj As Object Dim N As Long N = 0 Password = "test" With Application.VBE .MainWindow.Visible = True For Each VBProj In .VBProjects N = N + 1 If VBProj.Filename = WB.FullName Then Set .ActiveVBProject = .VBProjects(N) SendKeys "%TE+{TAB}{RIGHT}%V{TAB}" & Password & "{TAB}" & Password & "~", True Exit For End If Next VBProj .MainWindow.Visible = False End With End Sub There is a minor question remained: I couldn't make it work when started OpenVBProject via a hot key (say Ctrl+t). Do you have any explanation? Many thanks anyway! Regards, Stefi €˛Chip Pearson€¯ ezt Ć*rta: Stefi, Try code like: Sub OpenVBProject(WB As Workbook) Dim VBProj As Object Dim N As Long N = 0 With Application.VBE .MainWindow.Visible = True For Each VBProj In .VBProjects N = N + 1 If VBProj.Filename = WB.FullName Then Set .ActiveVBProject = .VBProjects(N) SendKeys "{ENTER}" SendKeys "aa" '<<< YOUR PASSWORD SendKeys "{ENTER}" Exit For End If End With Next VBProj End Sub You call this from a procedure as: OpenVBProject Workbooks("Book123.xls") -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Hi All, I tried to use (in XL2003) SendKeys "%{F11}", True to open VBE window, but it had no effect. In fact my real aim was SendKeys "%{F11}%TE+{TAB}{RIGHT}%V{+}{TAB}" & Password & "{TAB}" & Password & "~%{F11}", True to set VBA project password. I found out that "%{F11}" part doesn't work. If I previously open VBE window manually with Alt+F11, the remaining part sets the password. Any advice? Thanks, Stefi |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
SendKeys "%{F11}", True
I realized that it's a great weakness of VBA (XL2003). Have you heard of any
development in this question in later releases? Regards, Stefi €˛Chip Pearson€¯ ezt Ć*rta: Unfortunately, there is no programmatic way to modify the security settings of a VBProject. You can test the setting but not unlock the project. SendKeys, as poor as it is, is the only way to do it. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Well, I made it work via a Commandbutton. I would negligate using Sendkeys with pleasure, but how else could I achieve my aim (setting VBA project password)? Thanks for your assistance! Best regards, Stefi €˛Chip Pearson€¯ ezt Ć*rta: Do you have any explanation? Nothing beyond that SendKeys is very unreliable. I would never use it in commercial code. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Hi Chip, I found that this form works: Sub OpenVBProject(WB As Workbook) Dim VBProj As Object Dim N As Long N = 0 Password = "test" With Application.VBE .MainWindow.Visible = True For Each VBProj In .VBProjects N = N + 1 If VBProj.Filename = WB.FullName Then Set .ActiveVBProject = .VBProjects(N) SendKeys "%TE+{TAB}{RIGHT}%V{TAB}" & Password & "{TAB}" & Password & "~", True Exit For End If Next VBProj .MainWindow.Visible = False End With End Sub There is a minor question remained: I couldn't make it work when started OpenVBProject via a hot key (say Ctrl+t). Do you have any explanation? Many thanks anyway! Regards, Stefi €˛Chip Pearson€¯ ezt Ć*rta: Stefi, Try code like: Sub OpenVBProject(WB As Workbook) Dim VBProj As Object Dim N As Long N = 0 With Application.VBE .MainWindow.Visible = True For Each VBProj In .VBProjects N = N + 1 If VBProj.Filename = WB.FullName Then Set .ActiveVBProject = .VBProjects(N) SendKeys "{ENTER}" SendKeys "aa" '<<< YOUR PASSWORD SendKeys "{ENTER}" Exit For End If End With Next VBProj End Sub You call this from a procedure as: OpenVBProject Workbooks("Book123.xls") -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Hi All, I tried to use (in XL2003) SendKeys "%{F11}", True to open VBE window, but it had no effect. In fact my real aim was SendKeys "%{F11}%TE+{TAB}{RIGHT}%V{+}{TAB}" & Password & "{TAB}" & Password & "~%{F11}", True to set VBA project password. I found out that "%{F11}" part doesn't work. If I previously open VBE window manually with Alt+F11, the remaining part sets the password. Any advice? Thanks, Stefi |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
SendKeys "%{F11}", True
They haven't touched VBA since 2000 and even then it was a relatively minor
upgrade from 97. I doubt there will be any upgrades to VBA. My guess it that in a release or two we'll be working in NET. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... I realized that it's a great weakness of VBA (XL2003). Have you heard of any development in this question in later releases? Regards, Stefi €˛Chip Pearson€¯ ezt Ć*rta: Unfortunately, there is no programmatic way to modify the security settings of a VBProject. You can test the setting but not unlock the project. SendKeys, as poor as it is, is the only way to do it. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Well, I made it work via a Commandbutton. I would negligate using Sendkeys with pleasure, but how else could I achieve my aim (setting VBA project password)? Thanks for your assistance! Best regards, Stefi €˛Chip Pearson€¯ ezt Ć*rta: Do you have any explanation? Nothing beyond that SendKeys is very unreliable. I would never use it in commercial code. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Hi Chip, I found that this form works: Sub OpenVBProject(WB As Workbook) Dim VBProj As Object Dim N As Long N = 0 Password = "test" With Application.VBE .MainWindow.Visible = True For Each VBProj In .VBProjects N = N + 1 If VBProj.Filename = WB.FullName Then Set .ActiveVBProject = .VBProjects(N) SendKeys "%TE+{TAB}{RIGHT}%V{TAB}" & Password & "{TAB}" & Password & "~", True Exit For End If Next VBProj .MainWindow.Visible = False End With End Sub There is a minor question remained: I couldn't make it work when started OpenVBProject via a hot key (say Ctrl+t). Do you have any explanation? Many thanks anyway! Regards, Stefi €˛Chip Pearson€¯ ezt Ć*rta: Stefi, Try code like: Sub OpenVBProject(WB As Workbook) Dim VBProj As Object Dim N As Long N = 0 With Application.VBE .MainWindow.Visible = True For Each VBProj In .VBProjects N = N + 1 If VBProj.Filename = WB.FullName Then Set .ActiveVBProject = .VBProjects(N) SendKeys "{ENTER}" SendKeys "aa" '<<< YOUR PASSWORD SendKeys "{ENTER}" Exit For End If End With Next VBProj End Sub You call this from a procedure as: OpenVBProject Workbooks("Book123.xls") -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Hi All, I tried to use (in XL2003) SendKeys "%{F11}", True to open VBE window, but it had no effect. In fact my real aim was SendKeys "%{F11}%TE+{TAB}{RIGHT}%V{+}{TAB}" & Password & "{TAB}" & Password & "~%{F11}", True to set VBA project password. I found out that "%{F11}" part doesn't work. If I previously open VBE window manually with Alt+F11, the remaining part sets the password. Any advice? Thanks, Stefi |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
SendKeys "%{F11}", True
See you later in the brave new NET world!
Best regards, Stefi €˛Chip Pearson€¯ ezt Ć*rta: They haven't touched VBA since 2000 and even then it was a relatively minor upgrade from 97. I doubt there will be any upgrades to VBA. My guess it that in a release or two we'll be working in NET. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... I realized that it's a great weakness of VBA (XL2003). Have you heard of any development in this question in later releases? Regards, Stefi €˛Chip Pearson€¯ ezt Ć*rta: Unfortunately, there is no programmatic way to modify the security settings of a VBProject. You can test the setting but not unlock the project. SendKeys, as poor as it is, is the only way to do it. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Well, I made it work via a Commandbutton. I would negligate using Sendkeys with pleasure, but how else could I achieve my aim (setting VBA project password)? Thanks for your assistance! Best regards, Stefi €˛Chip Pearson€¯ ezt Ć*rta: Do you have any explanation? Nothing beyond that SendKeys is very unreliable. I would never use it in commercial code. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Hi Chip, I found that this form works: Sub OpenVBProject(WB As Workbook) Dim VBProj As Object Dim N As Long N = 0 Password = "test" With Application.VBE .MainWindow.Visible = True For Each VBProj In .VBProjects N = N + 1 If VBProj.Filename = WB.FullName Then Set .ActiveVBProject = .VBProjects(N) SendKeys "%TE+{TAB}{RIGHT}%V{TAB}" & Password & "{TAB}" & Password & "~", True Exit For End If Next VBProj .MainWindow.Visible = False End With End Sub There is a minor question remained: I couldn't make it work when started OpenVBProject via a hot key (say Ctrl+t). Do you have any explanation? Many thanks anyway! Regards, Stefi €˛Chip Pearson€¯ ezt Ć*rta: Stefi, Try code like: Sub OpenVBProject(WB As Workbook) Dim VBProj As Object Dim N As Long N = 0 With Application.VBE .MainWindow.Visible = True For Each VBProj In .VBProjects N = N + 1 If VBProj.Filename = WB.FullName Then Set .ActiveVBProject = .VBProjects(N) SendKeys "{ENTER}" SendKeys "aa" '<<< YOUR PASSWORD SendKeys "{ENTER}" Exit For End If End With Next VBProj End Sub You call this from a procedure as: OpenVBProject Workbooks("Book123.xls") -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Stefi" wrote in message ... Hi All, I tried to use (in XL2003) SendKeys "%{F11}", True to open VBE window, but it had no effect. In fact my real aim was SendKeys "%{F11}%TE+{TAB}{RIGHT}%V{+}{TAB}" & Password & "{TAB}" & Password & "~%{F11}", True to set VBA project password. I found out that "%{F11}" part doesn't work. If I previously open VBE window manually with Alt+F11, the remaining part sets the password. Any advice? Thanks, Stefi |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
SendKeys "{F},true does not work | Excel Worksheet Functions | |||
Typing "true" excel 2007 change it to "TRUE" | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
IF(VLOOKUP("MYDATA", MYNAME, 4) = 0, "TRUE", "FALSE") | Excel Programming |