Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default VBA Editor "flashing" while Excel is still NOT Visible to the user

Hi guys,

This is my very first time in this discussion group.

I work on an application that should run under both Excel 11.0 and Excel 12.0

I am automating Excel with the application NOT visible, but when running the
code below, the VBA Editor flashes on-screen.

How can I suppress that "flashing"?

Thanks in advance,
Aldo.

The following block of code should create a Sub into "ThisWorkbook".

Sub Create_Workbook_BeforeCloseSub()
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(ActiveWorkbook.CodeName)
Set CodeMod = VBComp.CodeModule

With CodeMod
LineNum = LineNum + 1: .InsertLines LineNum, "Option Explicit"
LineNum = .CreateEventProc("BeforeClose", "Workbook")
LineNum = LineNum + 1: .InsertLines LineNum, "
ActiveWorkbook.Close(False)"
End With

'Close VBA editor
Application.VBE.MainWindow.Visible = False

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,480
Default VBA Editor "flashing" while Excel is still NOT Visible to the user

Hi

Application.ScreenUpdating = False

your code

Application.ScreenUpdating = True
--
Regards
Roger Govier

"Aldo" wrote in message
...
Hi guys,

This is my very first time in this discussion group.

I work on an application that should run under both Excel 11.0 and Excel
12.0

I am automating Excel with the application NOT visible, but when running
the
code below, the VBA Editor flashes on-screen.

How can I suppress that "flashing"?

Thanks in advance,
Aldo.

The following block of code should create a Sub into "ThisWorkbook".

Sub Create_Workbook_BeforeCloseSub()
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(ActiveWorkbook.CodeName)
Set CodeMod = VBComp.CodeModule

With CodeMod
LineNum = LineNum + 1: .InsertLines LineNum, "Option Explicit"
LineNum = .CreateEventProc("BeforeClose", "Workbook")
LineNum = LineNum + 1: .InsertLines LineNum, "
ActiveWorkbook.Close(False)"
End With

'Close VBA editor
Application.VBE.MainWindow.Visible = False

End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default VBA Editor "flashing" while Excel is still NOT Visible to the user

Go to this site

http://www.cpearson.com/excel/vbe.aspx

and search for

Eliminating Screen Flicker During VBProject Code
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"Aldo" wrote:

Hi guys,

This is my very first time in this discussion group.

I work on an application that should run under both Excel 11.0 and Excel 12.0

I am automating Excel with the application NOT visible, but when running the
code below, the VBA Editor flashes on-screen.

How can I suppress that "flashing"?

Thanks in advance,
Aldo.

The following block of code should create a Sub into "ThisWorkbook".

Sub Create_Workbook_BeforeCloseSub()
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(ActiveWorkbook.CodeName)
Set CodeMod = VBComp.CodeModule

With CodeMod
LineNum = LineNum + 1: .InsertLines LineNum, "Option Explicit"
LineNum = .CreateEventProc("BeforeClose", "Workbook")
LineNum = LineNum + 1: .InsertLines LineNum, "
ActiveWorkbook.Close(False)"
End With

'Close VBA editor
Application.VBE.MainWindow.Visible = False

End Sub

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
Excel 2007 displays Locked by "another user", does not show User I Ana Excel Discussion (Misc queries) 2 January 19th 11 01:57 PM
Stop the "flashing" when I execute an Excel macro? Corinne Excel Discussion (Misc queries) 4 June 25th 09 08:09 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Screen "Flashing" on Window change Neal Zimm Excel Discussion (Misc queries) 0 September 28th 06 01:35 PM
Password visible if user selects "view code" kcdonaldson Excel Worksheet Functions 2 December 3rd 05 03:48 PM


All times are GMT +1. The time now is 07:14 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"