AW: Ohne Select
20.02.2009 08:44:00
Michel
So,
das was sich in der Vordergrund drängt ist ein VBA-Fenster.
Da ich Code in eine neue Arbeitsmappe kopiere mit:
Sub AddWorkbookEvent(neuName)
Dim lngStartLine As Long
Dim a As Integer, b As Integer
With Application
.StatusBar = "
Sub AddWorkbookEvent(neuName)"
.DisplayAlerts = False
.VBE.MainWindow.Visible = False
a = .VBE.MainWindow.Height 'Fenstergröße merken
b = .VBE.MainWindow.Width ' Fenstergröße merken
.VBE.MainWindow.Height = 0
.VBE.MainWindow.Width = 0
End With
With Workbooks(neuName).VBProject.VBComponents("DieseArbeitsmappe") _
.CodeModule
' Codeschablone einfügen
lngStartLine = .CreateEventProc("Open", "Workbook") + 1
Application.VBE.MainWindow.Visible = False
' Code in Ereignis-Prozedur einfügen
.InsertLines lngStartLine, _
"Dim i, spalte, jetztwoche, woche, wt As Single" & Chr$(13) _
& "Dim aktuelldatum As Date" & Chr$(13) _
& "Application.ScreenUpdating = False" & Chr$(13) _
& "Application.Calculation = xlManual" & Chr$(13) _
& "ActiveWorkbook.Colors(15) = RGB(210, 210, 210)" & Chr$(13) _
& "ActiveWorkbook.Colors(16) = RGB(180, 180, 180)" & Chr$(13) _
hier folgt noch mehr Code
' Codeschablone einfügen
lngStartLine = .CreateEventProc("BeforeClose", "Workbook") + 1
' Code in Ereignis-Prozedur einfügen
.InsertLines lngStartLine, _
"ThisWorkbook.Saved = True"
With Application
.VBE.MainWindow.Visible = False
.VBE.MainWindow.Height = a
.VBE.MainWindow.Width = b
.DisplayAlerts = True
End With
End With
End Sub
und wenn dieses Modul aufgerufen wird, kommt das Fenster in den Vordergrund, das lässt sich auch mit Screenupdating = false nicht verhindern? oder gibt es eine Möglichkeint?
Ich mache das Fenster schon ganz klein .VBE.MainWindow.Height = 0 aber die Symbolleisten sind immer noch da!
Gruß
Michael