Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have an automated application that modifies a number of workbooks by adding some forms and modules to each one, then saves and closes them. During this process, I use Application.visible = false to hide all the opening/closing workbooks so that the user can do other work without focus jumping to Excel. The problem is that for some reason, the Visual Basic window opens at some point and never closes. This defeats the purpose of making the application visible and I don't know why it's opening the window. It also confuses the user running the application because she doesn't know anything about excel. Any ideas on what command is actually making VBA visible? Any ideas on how to make it invisible? This one's a real bear because if I put a "Stop" or Pause in VBA, VBA automatically becomes visible so there's no way for me to see what's tripping the visiblity property. Thanks, MikeZz Here is the basic routine that copies over the forms and modules: Public Sub SendForms() errMaster = "SendForms: Sending Macros" srcWB.VBProject.VBComponents("frmNotFound").Export Filename:=sStr destWb.VBProject.VBComponents.Import Filename:=sStr srcWB.VBProject.VBComponents("StartupForm").Export Filename:=sStr destWb.VBProject.VBComponents.Import Filename:=sStr srcWB.VBProject.VBComponents("ExportCode").Export Filename:=sStr destWb.VBProject.VBComponents.Import Filename:=sStr Kill sStr Dim VBProj As VBIDE.VBProject Dim VBComp As VBIDE.VBComponent Dim CodeMod As VBIDE.CodeModule Dim LineNum As Long Const DQUOTE = """" ' one " character Set VBProj = ActiveWorkbook.VBProject Set VBComp = VBProj.VBComponents("ThisWorkbook") Set CodeMod = VBComp.CodeModule With CodeMod LineNum = .CreateEventProc("Open", "Workbook") LineNum = LineNum + 1 .InsertLines LineNum, " ThisWorkbook.Sheets(" & DQUOTE & "VeryHidden" & DQUOTE & ").Visible = xlVeryHidden" LineNum = LineNum + 1 .InsertLines LineNum, " StartupForm.Show" End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Delete all modules and forms from workbook | Excel Programming | |||
Copying UserForms & Modules to another workbook | Excel Programming | |||
Public, Private, Event modules, Forms modules,,, | Excel Programming | |||
Extracting (copying) modules from one workbook to another. | Excel Programming | |||
Copying VBA modules from one workbook to another with a macro? | Excel Programming |