Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default screenupdating = false not working in Workbook_open sub


Application.ScreenUpdating = False

This code works well except in the Private Sub Workbook_Open() macro
where it seems to be comepletely ignored. Why?

thanks,
Tommy


--
TommySzalapski
------------------------------------------------------------------------
TommySzalapski's Profile: http://www.excelforum.com/member.php...o&userid=25561
View this thread: http://www.excelforum.com/showthread...hreadid=391960

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default screenupdating = false not working in Workbook_open sub

I've never seen this line ignored.

But I have seen calls to built in routines turn it back on. (No, I don't
remember what they were. Sorry.)

Maybe you can post your troublesome code (and the version of excel) that causes
the problem.

TommySzalapski wrote:

Application.ScreenUpdating = False

This code works well except in the Private Sub Workbook_Open() macro
where it seems to be comepletely ignored. Why?

thanks,
Tommy

--
TommySzalapski
------------------------------------------------------------------------
TommySzalapski's Profile: http://www.excelforum.com/member.php...o&userid=25561
View this thread: http://www.excelforum.com/showthread...hreadid=391960


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default screenupdating = false not working in Workbook_open sub


I am using Excel 2000 (from the Office 2000 SR-Professional package) an
this is the code where screenupdating = false is ignored

Private Sub Workbook_Open()

Dim strDriver As String
Dim driverFile As Workbook

strDriver = Worksheets("Form").Range("B1").Value

If Len(Dir(strDriver, vbDirectory)) = 0 Then
strDriver = ThisWorkbook.Path & "\" & strDriver
End If

If Len(Dir(strDriver)) = 0 Then ' file does not exist
* MsgBox "File not found: " & strDriver, vbExclamation, "Error!"
strDriver = Application.GetOpenFilename("Excel Workbooks,*.xls, Al
Files, *.*", _
1, "Select the report compiler file.")

If strDriver = "False" Then
MsgBox "No driver file loaded; reports will not work."
vbExclamation, "Error!"
Exit Sub
End If

End If

Application.ScreenUpdating = False

Set driverFile = Workbooks.Open(strDriver)

strDataPath = driverFile.Path & "\" & "Data"

If ThisWorkbook.Path = driverFile.Path Then
Worksheets("Form").Range("B1").Value = Dir(strDriver)
Else
Worksheets("Form").Range("B1").Value = strDriver
End If

strDriver = Dir(strDriver)

driverFile.Worksheets("Info").UsedRange.Copy _
ThisWorkbook.Worksheets("Info").Range("A1")
driverFile.Worksheets("Data").UsedRange.Copy _
ThisWorkbook.Worksheets("Data").Range("A1")

Workbooks(strDriver).Close

Worksheets("Form").Range("B3").Value
Worksheets("Info").Range("A12").Value
Worksheets("Form").Range("B4").Value
Worksheets("Info").Range("A14").Value
Worksheets("Form").Range("B5").Value
Worksheets("Info").Range("A13").Value

Worksheets("Form").eDepartment.ListFillRange = "Info!F2:F"
Worksheets("Info").Range("E1")
Worksheets("Form").eDepartment.Height = (Worksheets("Info").Range("E1"
- 1) * 12.5
Worksheets("Form").Activate
Worksheets("Form").eFromYear.Value
Worksheets("Form").Range("B3").Value
Worksheets("Form").eToYear.Value
Worksheets("Form").Range("B3").Value
Worksheets("Form").eFromWeek.Value
Worksheets("Form").Range("B5").Value - 1
Worksheets("Form").eToWeek.Value = Worksheets("Form").Range("B5").Valu
- 1

Application.ScreenUpdating = True

End Su

--
TommySzalapsk
-----------------------------------------------------------------------
TommySzalapski's Profile: http://www.excelforum.com/member.php...fo&userid=2556
View this thread: http://www.excelforum.com/showthread.php?threadid=39196

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default screenupdating = false not working in Workbook_open sub

I didn't set up a workbook that mimicked your workbook (way too much work!).

But I didn't see anything that would cause the application.screenupdating not to
work.

You could add a few lines that might help you determine where it gets turned
back on, though:

Pepper your code with:
Debug.Print "step 1: " & Application.ScreenUpdating
'your code
Debug.Print "step 2: " & Application.ScreenUpdating
'more of your code
Debug.Print "step 3: " & Application.ScreenUpdating
'etc....

Then after it runs, you can look at the immediate window (in the VBE) to see
what's happening.



TommySzalapski wrote:

I am using Excel 2000 (from the Office 2000 SR-Professional package) and
this is the code where screenupdating = false is ignored

Private Sub Workbook_Open()

Dim strDriver As String
Dim driverFile As Workbook

strDriver = Worksheets("Form").Range("B1").Value

If Len(Dir(strDriver, vbDirectory)) = 0 Then
strDriver = ThisWorkbook.Path & "\" & strDriver
End If

If Len(Dir(strDriver)) = 0 Then ' file does not exist
* MsgBox "File not found: " & strDriver, vbExclamation, "Error!"
strDriver = Application.GetOpenFilename("Excel Workbooks,*.xls, All
Files, *.*", _
1, "Select the report compiler file.")

If strDriver = "False" Then
MsgBox "No driver file loaded; reports will not work.",
vbExclamation, "Error!"
Exit Sub
End If

End If

Application.ScreenUpdating = False

Set driverFile = Workbooks.Open(strDriver)

strDataPath = driverFile.Path & "\" & "Data"

If ThisWorkbook.Path = driverFile.Path Then
Worksheets("Form").Range("B1").Value = Dir(strDriver)
Else
Worksheets("Form").Range("B1").Value = strDriver
End If

strDriver = Dir(strDriver)

driverFile.Worksheets("Info").UsedRange.Copy _
ThisWorkbook.Worksheets("Info").Range("A1")
driverFile.Worksheets("Data").UsedRange.Copy _
ThisWorkbook.Worksheets("Data").Range("A1")

Workbooks(strDriver).Close

Worksheets("Form").Range("B3").Value =
Worksheets("Info").Range("A12").Value
Worksheets("Form").Range("B4").Value =
Worksheets("Info").Range("A14").Value
Worksheets("Form").Range("B5").Value =
Worksheets("Info").Range("A13").Value

Worksheets("Form").eDepartment.ListFillRange = "Info!F2:F" &
Worksheets("Info").Range("E1")
Worksheets("Form").eDepartment.Height = (Worksheets("Info").Range("E1")
- 1) * 12.5
Worksheets("Form").Activate
Worksheets("Form").eFromYear.Value =
Worksheets("Form").Range("B3").Value
Worksheets("Form").eToYear.Value =
Worksheets("Form").Range("B3").Value
Worksheets("Form").eFromWeek.Value =
Worksheets("Form").Range("B5").Value - 1
Worksheets("Form").eToWeek.Value = Worksheets("Form").Range("B5").Value
- 1

Application.ScreenUpdating = True

End Sub

--
TommySzalapski
------------------------------------------------------------------------
TommySzalapski's Profile: http://www.excelforum.com/member.php...o&userid=25561
View this thread: http://www.excelforum.com/showthread...hreadid=391960


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default screenupdating = false not working in Workbook_open sub


The Workbooks.Open command is setting it back to true. I tried adding

With driverFile
..Application.ScreenUpdating = false
End With

and it did turn back off, but after printing the newly opened book to
the screen

Wait, I just figured it out, the workbook I am opening also disables
screen updating and reenables it in its open event. How can I get
around this? Is there a way to open the file and disable its macros?
(That doesn't seem to be a parameter for the open method)


--
TommySzalapski
------------------------------------------------------------------------
TommySzalapski's Profile: http://www.excelforum.com/member.php...o&userid=25561
View this thread: http://www.excelforum.com/showthread...hreadid=391960



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default screenupdating = false not working in Workbook_open sub

Application.EnableEvents = False
' open the workbook
Application.EnableEvents = True

--
Regards,
Tom Ogilvy

"TommySzalapski"
<TommySzalapski.1t56yn_1122995159.7006@excelforu m-nospam.com wrote in
message news:TommySzalapski.1t56yn_1122995159.7006@excelfo rum-nospam.com...

The Workbooks.Open command is setting it back to true. I tried adding

With driverFile
Application.ScreenUpdating = false
End With

and it did turn back off, but after printing the newly opened book to
the screen

Wait, I just figured it out, the workbook I am opening also disables
screen updating and reenables it in its open event. How can I get
around this? Is there a way to open the file and disable its macros?
(That doesn't seem to be a parameter for the open method)


--
TommySzalapski
------------------------------------------------------------------------
TommySzalapski's Profile:

http://www.excelforum.com/member.php...o&userid=25561
View this thread: http://www.excelforum.com/showthread...hreadid=391960



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default screenupdating = false not working in Workbook_open sub


That did it.

thanks


--
TommySzalapski
------------------------------------------------------------------------
TommySzalapski's Profile: http://www.excelforum.com/member.php...o&userid=25561
View this thread: http://www.excelforum.com/showthread...hreadid=391960

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
How to set Application.ScreenUpdating = False for Gen use David_Williams_PG () Excel Discussion (Misc queries) 1 August 15th 06 12:06 PM
What does ScreenUpdating = False do? Judy Ward Excel Worksheet Functions 5 July 9th 05 09:25 AM
Auto_Open/Workbook_Open subroutines showing SCREENUPDATING WhytheQ Excel Programming 2 July 5th 05 03:50 PM
Using the Application.ScreenUpdating = False? Susan Hayes Excel Programming 0 January 29th 05 03:50 AM
Application.ScreenUpdating = False Pieter Kuyck Excel Programming 2 July 15th 03 06:28 PM


All times are GMT +1. The time now is 12:36 AM.

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"