Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Sub openfile() Dim wkdir as string, openworkbookname as string wkdir="C:\" k=0 Do until k=100 openfileworkname= k&".htm" If CheckFileAvailable(wkdir & openworkbookname) = "Fileinfree" Then 'Sleep(100) 'Application.EnableEvents = False 'ClearClipboard Excel.Application.Workbooks.Open filename:=wkdir & openworkbookname, ReadOnly:=False Doevent or ... 'Application.EnableEvents = True Endif k=k+1 Loop End Sub Function CheckFileAvailable(sFilePath) On Error Resume Next Dim oFS Dim oFile Set oFS = CreateObject("Scripting.FileSystemObject") Set oFile = oFS.OpenTextFile(sFilePath, 8, False) If Err.Number <> 0 Then CheckFileAvailable = "Fileinuse" ' Debug.Print "FileinUse" Else CheckFileAvailable = "Fileisfree" Debug.Print "FileisFree" End If End Function Public Function ClearClipboard() OpenClipboard (0&) EmptyClipboard CloseClipboard End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Calculating earleist date and latest date based on MAX and MIN in Weeks and Days Late.||2||42|
|any combination of this numbers||9||33|
|Vba code to spell check an excel document in a set range||9||29|
|Script/Formula to move data to another cell||6||22|