ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Screenupdating=false not working (https://www.excelbanter.com/excel-programming/395079-screenupdating%3Dfalse-not-working.html)

SteveF[_3_]

Screenupdating=false not working
 
All of a sudden screenupdating =false does not work
Now screen updating does not seem to work- I added the msgboxes to see
what the variable is- it is False the first time and True the second
time- what is triggering the change?




When I run this code the value of screenupdating goes from False to
True when the msgbox is displayed?
I have no idea why - (Excel 2007)

Sub Macro1()


Application.ScreenUpdating = False
Application.DisplayAlerts = False
mybook = ActiveWorkbook.Name


myfolder = Range("i1")
myfile = Range("i2")
myfile = myfolder & myfile
MsgBox Application.ScreenUpdating


'
Application.StatusBar = "opening ap.txt"
Workbooks.OpenText Filename:= _
myfile _
, Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:= _
Array(Array(0, 9), Array(6, 1), Array(15, 9), Array(23, 1),
Array(47, 9), Array(67, 1), _
Array(74, 9), Array(82, 9), Array(96, 9), Array(107, 1))


MsgBox Application.ScreenUpdating

'more code
End Sub


Ray

Screenupdating=false not working
 
Steve -

It's got to be something with the external workbook that you're
opening .... I tried it with the part of the code 'commented out' and
it worked fine (msgbox = false both times).

ray


SteveF[_3_]

Screenupdating=false not working
 
On Aug 8, 2:53 pm, SteveF wrote:
All of a suddenscreenupdating=false does not work
Now screen updating does not seem to work- I added the msgboxes to see
what the variable is- it is False the first time and True the second
time- what is triggering the change?

When I run this code the value ofscreenupdatinggoes from False to
True when the msgbox is displayed?
I have no idea why - (Excel 2007)

Sub Macro1()

Application.ScreenUpdating= False
Application.DisplayAlerts = False
mybook = ActiveWorkbook.Name

myfolder = Range("i1")
myfile = Range("i2")
myfile = myfolder & myfile
MsgBox Application.ScreenUpdating

'
Application.StatusBar = "opening ap.txt"
Workbooks.OpenText Filename:= _
myfile _
, Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:= _
Array(Array(0, 9), Array(6, 1), Array(15, 9), Array(23, 1),
Array(47, 9), Array(67, 1), _
Array(74, 9), Array(82, 9), Array(96, 9), Array(107, 1))

MsgBox Application.ScreenUpdating

'more code
End Sub



This is happening even when opening a file is not involved



All times are GMT +1. The time now is 09:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com