LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default Hide VBProject while copying Forms & Modules to another workbook

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
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
Delete all modules and forms from workbook Daniel Bonallack Excel Programming 2 June 2nd 06 02:34 AM
Copying UserForms & Modules to another workbook excelnut1954 Excel Programming 2 May 24th 06 10:19 PM
Public, Private, Event modules, Forms modules,,, Jim May Excel Programming 11 October 31st 05 03:12 AM
Extracting (copying) modules from one workbook to another. Devin Linnington Excel Programming 1 July 6th 05 11:59 PM
Copying VBA modules from one workbook to another with a macro? Revolvr[_2_] Excel Programming 2 May 6th 04 11:04 AM


All times are GMT +1. The time now is 11:17 AM.

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

About Us

"It's about Microsoft Excel"