Screenupdating=false not working

S

SteveF

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
 
R

Ray

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
 
S

SteveF

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top