Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the follow-up Bob. I ran it, but I get an "Argument not
optional" error on the line If FileCountOK Then Am I doing something wrong? I'm runnung the ProcessFiles sub. Thanks! "Bob Phillips" wrote in message ... Private Declare Function SHBrowseForFolder Lib "shell32.dll" _ Alias "SHBrowseForFolderA" _ (lpBrowseInfo As BROWSEINFO) As Long Private Type BROWSEINFO hOwner As Long pidlRoot As Long pszDisplayName As String lpszTitle As String ulFlags As Long lpfn As Long lParam As Long iImage As Long End Type Sub ProcessFiles() Dim FSO As ObjectDim fldr As Object Dim sFolder As String Dim Folder As Object Set FSO = CreateObject("Scripting.FileSystemObject") sFolder = "C:\evaluation" If sFolder < "" Then Set Folder = FSO.GetFolder(sFolder) If FileCountOK Then StephsMacro End If End If ' sFolder < "" End Sub Function FileCountOK(pzFolder as Object) Dim i As Long Dim file As Object Dim Files As Object FileCountOK = TRUE Set Files = pzFolder.Files For Each file In Files If file.Type = "Microsoft Excel Worksheet" Then i=i+1 Workbooks.Open Filename:=file.Path With ActiveWorkbook FileCountOK = .Activesheet.Range("AQ1").Value = 1 .Close savechanges:=False If Not FileCountOK The Exit Function End With End If Next file End Function -- HTH RP |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
add a folder to c:\ drive from cell A1 contents... | Excel Discussion (Misc queries) | |||
Copy a cell to all workbooks within a folder. | Excel Discussion (Misc queries) | |||
Add contents of A1 in all workbooks within a folder | Excel Programming | |||
Using Cell Contents to Reference External Workbooks | Excel Programming | |||
Loop through workbooks in a folder and return the value of cell M43 | Excel Programming |