Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.
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
|Link a VBS to an HTA||6||36|
|How to get many filtered in Excel 2010?||7||31|
|VBA - If Bookmark = "XXBOOKMARKXX" then||15||25|