Error Application.ScreenUpdating

S

Sangeeta

Hi,
I am trying to get data from a collection of excel sheets. But when it
try ot execute. I get an error at

"Application.ScreenUpdating =false"
It says "Method or data member not found!"
Could someone please help me?

Dim objFSO As Object
Dim objFolder As Object
Dim objSubfolder As Object
Dim objFile As Object
Dim iRow As Long
Dim oDetails As Workbook
Dim oSheet As Worksheet



Set oDetails = Workbooks.Add
Set oSheet = oDetails.Worksheets(1)
Application.ScreenUpdating =false
iRow = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("c:\MyTest\")
For Each objFile In objFolder.Files
If objFile.Type = "Microsoft Excel Worksheet" Then
Workbooks.Open Filename:=objFolder.Path & "\" &
objFile.Name
oSheet.Cells(iRow, 1).Value = objFolder.Path & "\" &
objFile.Name
oSheet.Cells(iRow, 2).Value =
ActiveWorkbook.Worksheets(1).Range("F45").Value
ActiveWorkbook.Close savechanges:=False
iRow = iRow + 1
End If
Next
Application.ScreenUpdating = True
End Function
 
G

Guest

That code worked just fine for me... You might want to try looking for
missing references or for issues in other procedures which keep the code from
compiling... (use Debug -> Compile)
 
N

NickHK

You must have some problem with this line because if VBA had read/compiled
it, "false" would be changed to "False"
Application.ScreenUpdating =false

May be there some characters at the start of the line that are neither
spaces nor tabs.

NickHK
 

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

Similar Threads


Top