Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Creating excel file, adding code to it from code, VBE window stays

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(Cla ssType:="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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting all code in new file only (creating using save as) CB Excel Programming 15 March 20th 09 03:56 PM
VBA line of code executes in Immediate Window but not in Code Window [email protected] Excel Discussion (Misc queries) 2 April 30th 07 02:52 PM
Shorten code to apply to all sheets except a few, instead of individually naming them, and later adding to code. Corey Excel Programming 3 December 11th 06 05:14 AM
Seting a Constant (via code) when creating a new file based on a template Conan Kelly Excel Programming 1 July 15th 05 05:15 PM
Import VBA Code in Excel-File ? (Export VBA Code to file) Matthias Pospiech Excel Programming 2 March 22nd 05 04:56 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"