|
-
Mar 31st, 2004, 08:31 PM
#1
Thread Starter
Lively Member
EXCEL VB and VBE - hummm...
Can this be done...
Is it possible to have code within a VBA module, that once activated via a button on a worksheet, would open the VBE Editor, and given a password found within its own code, unlock its own module for viewing.
Just trying to save me a bit of time each time I open my files for editing. Working on a global - programmer password that unlocks all my sheets, gives me back my toolbars, and hopefully, opens up my VBE for me.
-----
#VBA, VB 6 Professional Edition, Office XP Developper. Excel 97, Excel 2000, Excel XP
I miss my VIC 20.
Never should have upgraded to my commodore 64. ...
-
Apr 2nd, 2004, 01:08 AM
#2
Yes you can access the VBA Projects through code, but I havent
found anything yet on passing the passwords. Here is the first
step in allowing access to the project through code.
To turn on trusted access to Visual Basic Projects:
1.) On the Tools menu, point to Macro, and then click Security.
2.) On the Trusted Sources tab, select the Trust access to Visual
3.) Basic Project check box.
After that I wrote this code and saved it in a document (not the
Normal.dot template) to prompt you to turn project protection off,
but the property is read only and can not be set programmatically.
So, I ended up writting more to open the VBA editor and attempt
to open the project. So this is where I am at and its time to go to
sleep. Have to go to client site tomorrow to do a db migration.
VB Code:
Option Explicit
Private Sub Document_Open()
Call AltF11
End Sub
Private Function AltF11()
MsgBox "Opening the VBA editor", vbOKOnly + vbInformation
Application.ShowVisualBasicEditor = True
If MsgBox("Turn project protection off?", vbYesNo + vbQuestion) = vbYes Then
'VBE.VBProjects.Item("Project").Protection = 0 'Read Only Property.
End If
MsgBox "Cant programmatically turn off protection." _
& vbNewLine & "I will try to open the project for you!", vbOKOnly + vbInformation
VBE.VBProjects.Item("project").VBE.CodePanes.Item(1).Show
'VBE.VBProjects.Item("project").VBE.CodePanes.Item(1).Window.Close 'Closes the project
End Function
Dont forget to turn trusted access to Visual
Basic Projects back off when you are done. Security threat.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 3rd, 2004, 03:23 PM
#3
Any luck yet, TheFIDDLER?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 3rd, 2004, 03:46 PM
#4
Thread Starter
Lively Member
ACtually - got sidetracked with a few loose ends I have to fix to meet a deadline. Will look at it tonight. THanks.
-----
#VBA, VB 6 Professional Edition, Office XP Developper. Excel 97, Excel 2000, Excel XP
I miss my VIC 20.
Never should have upgraded to my commodore 64. ...
-
Apr 3rd, 2004, 04:46 PM
#5
Working on the weekend? Are you a contractor or just trying to get ahead?
I kind of feel that there will not be any simple solution to it, or
any at all, in this area. Looks like M$ locked it down for security
reasons.

ps. any relation to The Riddler from Batman?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 3rd, 2004, 07:26 PM
#6
Thread Starter
Lively Member
Working weekend - yup!
This is actually my second job. I am the manager of a retail store during the day. Computer programmer with my own software company by night.
Never met the Riddler - doubt were related - but it is a small world. Name came from me trying to learn how to play the fiddle.
-----
#VBA, VB 6 Professional Edition, Office XP Developper. Excel 97, Excel 2000, Excel XP
I miss my VIC 20.
Never should have upgraded to my commodore 64. ...
-
Apr 3rd, 2004, 09:13 PM
#7
What is your company name?
Was it hard to start your own software company? I had thought
about it a couple of years ago until the economy fell apart. So for
now, I am staying with the computer consulting company I am
currently at for a while more.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 3rd, 2004, 11:22 PM
#8
Thread Starter
Lively Member
I called it Estimator One Software. Specializing in home estimating software for the retail building supply industry.
Actually came as an off-shoot where other stores in my buying group saw some of my work and asked how they could get a copy of the software. My program is now in use from coast to coast.
So I spend a bit of time each day on these bulletin boards trying to learn new things and to get better at what I do.
I have a new release due out at the end of April, so that's why I've been posting all these tidbits.
Going to back to our post topic -
Here is how to get it working:
First if using Excel 2002 - Security - Check trusted sources. Otherwise this will lock out the vbproject.
ALso, you need a reference to Microsoft Visual Basic for Applications Extensionability.
Haven't got the password part yet, but it is fairly easy to open the VB editor using code. You can manipulate the object model without too much complications. I will play around with it so that I get it opening with my preferences and screen layout.
Also works with 97, 2000 and 2002.
VB Code:
sub showVBE()
Dim oVBE As VBIDE.VBE
Set oVBE = Application.VBE
oVBE.MainWindow.Visible = True
End sub
-----
#VBA, VB 6 Professional Edition, Office XP Developper. Excel 97, Excel 2000, Excel XP
I miss my VIC 20.
Never should have upgraded to my commodore 64. ...
-
Apr 4th, 2004, 12:12 AM
#9
I was wondering what the difference between my code above and yours?
VB Code:
VBE.VBProjects.Item("project").VBE.CodePanes.Item(1).Show
They both do the same, but mine opens any named module or classe and yours can only open the
module or class that the function is in.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 4th, 2004, 09:19 PM
#10
Thread Starter
Lively Member
I can't seem to get your bit of code to work for me in 97 or 02.
I keep getting an object required error message.
Did you add any specific project references to get it to work?
-----
#VBA, VB 6 Professional Edition, Office XP Developper. Excel 97, Excel 2000, Excel XP
I miss my VIC 20.
Never should have upgraded to my commodore 64. ...
-
Apr 4th, 2004, 11:28 PM
#11
No. but I am running Office 2003. Perhaps that is why?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 5th, 2004, 09:28 PM
#12
Just double checked, I do have the reference "Microsoft Visual
Basic for Applications Extensibility 5.3" selected.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|