PC Review


Reply
Thread Tools Rate Thread

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

 
 
BlueWolverine
Guest
Posts: n/a
 
      5th Nov 2009
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.


--
BlueWolverine
MSE - Mech. Eng.
Go BLUE!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Command Buttons from VBA - adding code tcb Microsoft Excel Discussion 3 16th Dec 2007 03:04 PM
Issue with Code Creating Excel File BW Microsoft Access VBA Modules 2 10th Aug 2006 02:24 PM
Creating a new session using window.open and server-side code =?Utf-8?B?Sm9obiBTY290dA==?= Microsoft Dot NET 5 23rd May 2006 06:07 PM
Import VBA Code in Excel-File ? (Export VBA Code to file) Matthias Pospiech Microsoft Excel Programming 2 22nd Mar 2005 04:56 PM
adding code when creating collection Bekende Vlaming Microsoft C# .NET 2 2nd Nov 2003 12:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:45 PM.