Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have a macro that writes another macro programatically. Does anyone know how to protect the VBA code and then close VBE progrmatically? -- biosci ------------------------------------------------------------------------ biosci's Profile: http://www.excelforum.com/member.php...o&userid=32827 View this thread: http://www.excelforum.com/showthread...hreadid=531147 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following line should close the VBE:
Application.VBE.MainWindow.Visible = False As for protecting the project, I think you're stuck with using Sendkeys. Check out Sendkeys in Help. I don't have the Help file loaded on this machine, so the appended code example is from memory only. It appears to work but probably could be improved. I have commented out the last Tab and Enter ("{TAB}~") which will close the dialog and not let you see what happens. I did the same for the line that closes the VBE. Uncomment these in your code. Regards, Greg Const pwd As String = "monkey" Sub Test() With Application .SendKeys "%Te+{TAB}{Right}", True .SendKeys "%v", True .SendKeys "%p" & pwd, True .SendKeys "%c" & pwd, True '.SendKeys "{TAB}~" 'DoEvents '.VBE.MainWindow.Visible = False End With End Sub "biosci" wrote: I have a macro that writes another macro programatically. Does anyone know how to protect the VBA code and then close VBE progrmatically? -- biosci ------------------------------------------------------------------------ biosci's Profile: http://www.excelforum.com/member.php...o&userid=32827 View this thread: http://www.excelforum.com/showthread...hreadid=531147 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks Greg. That worked briliiantly. -- biosci ------------------------------------------------------------------------ biosci's Profile: http://www.excelforum.com/member.php...o&userid=32827 View this thread: http://www.excelforum.com/showthread...hreadid=531147 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Protect cells with data on save/close | Excel Worksheet Functions | |||
how to setup a excel sheet to be protect after save and close file | Excel Discussion (Misc queries) | |||
Can I protect a document and still open / close groups | Excel Worksheet Functions | |||
Add/Run macro programatically OLE error | Excel Programming | |||
Programatically close a file without saving | Excel Programming |