Home > Software engineering >  Open the file has a problem, ask ace to help me modify the!
Open the file has a problem, ask ace to help me modify the!

Time:12-01

Sub test ()
Dim mFolder As String
Dim As Integer I
Dim As Integer k

Dim MyDate
MyDate=Date
Range (" AD3 "). The Value=https://bbs.csdn.net/topics/MyDate

K=6

MFolder=ThisWorkbook. Path
[A4]="path"
'[B1]="file name"
With the Application. The FileSearch
. NewSearch
. LookIn=mFolder
. SearchSubFolders=False
The FileType=msoFileTypeExcelWorkbooks

If the Execute () & gt; 0 Then
For I=1 To. FoundFiles. Count
If the FoundFiles (I) & lt;> ThisWorkbook. FullName Then
Call Write_In (. FoundFiles (I))
End the If

If I Mod 2=0 Then
Range (" B "& amp; K & amp; ": the AD" & amp; K + 1). Select
With the Selection. The Interior
. ColorIndex=8
. The Pattern=xlSolid
End With
End the If
K=k + 2
Next I
The Else
MsgBox "folder" & amp; MFolder & amp; "There is no necessary files"
End the If
End With
Range (" A4: A80 "). The Clear

End Sub

CodePudding user response:

All commented On the Error Resume Next statement, running in the VBA IDE,
The error and then click the debugging, the cursor will stop error in the statement,
Or
In doubt may have a logical error statements in advance to set breakpoints, run through the breakpoint interrupt,

At this point can be used in the immediate window
? The variable name
Or
? The function name () function parameter
Or
Process (parameters)
Auxiliary debugging,
  •  Tags:  
  • VBA
  • Related