Creating excel file, adding code to it from code, VBE window stays

B

BlueWolverine

Hello,
MS ACCESS/EXCEL 2003 on XP PRO.

I have an access database that creates/exports and excel file/application.
After the file is exported, the VBA in access adds a module and event
procedures to the excel file.

This works well so far, but while the excel application closes at the end,
the VBE (Visual Basic Editor "Code Window") window stays open. This is a
problem. Does anyone have any idea how to close the VBE window using code,
or to close out the project so the window closes, etc?

Thanks.

Below is some snippets of the code to give you an idea of some of the syntax
I'm using.
''''''''''''''''''
'Begin Code''''
''''''''''''''''''''''''''
Dim vba_editor As VBIDE.VBE
Dim vbp_access, vbp_excel As VBIDE.VBProject
Dim vbp_comp As VBIDE.VBComponent
Dim vbp_code As VBIDE.CodeModule
Dim obj_button As OLEObject
Dim lng_line As Long
Dim str_module As String

'<><><><><><><><><><><>
str_wkb = str_file & str_extension
Set app_xls = Excel.Application
Set vbp_excel = app_xls.Workbooks(str_wkb).VBProject
'<><><><><><><><><><><>
Set vbp_comp = vbp_excel.VBComponents.Add(vbext_ct_StdModule)
vbp_comp.Name = "C1000ToolKit"
'<><><><><><><><><><><>
Set obj_button =
app_xls.Sheets("Control_Panel").OLEObjects.Add(ClassType:="Forms.CommandButton.1", Left:=20, Top:=int_top, Height:=20, Width:=80)
'<><><><><><><><><><><>
Set vbp_code = vbp_comp.CodeModule
'<><><><><><><><><><><>
With vbp_code
.InsertLines l, str_module
End With


Thanks once again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top