vba问题ThisWorkbook.Path & "\" & CStr(Trim(Sheets(sheet1).Range("A1").Value)) & "_setpoints.csv"
FunctionDeleteCaseSetpointsFile()AsBoolean'''!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!...
Function DeleteCaseSetpointsFile() As Boolean
'''!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
''' !
'''Description: !
''' This function is used to delete the case setpoint file. !
''' !
'''Parameter : !
''' !
'''ReturnValue: !
'''!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
DeleteCaseSetpointsFile = False
sSetpointsFileNameWithPath = ThisWorkbook.Path & "\" & CStr(Trim(Sheets(sSetpoints).Range("E2").Value)) & "_setpoints.csv" 这句话什么意思,主要是"_setpoints.csv" 这个什么意思,新手求解释
If Dir(sSetpointsFileNameWithPath) <> "" Then
On Error GoTo FileDeleteError:
Kill sSetpointsFileNameWithPath ' deletes the file if it exists
End If
DeleteCaseSetpointsFile = True
Exit Function
FileDeleteError:
MsgBox Sheets(sSetpoints).Range("E2").Value & "_setpoints.csv " & "File is not available for writing", vbInformation, ThisWorkbook.Name
End Function 展开
'''!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
''' !
'''Description: !
''' This function is used to delete the case setpoint file. !
''' !
'''Parameter : !
''' !
'''ReturnValue: !
'''!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
DeleteCaseSetpointsFile = False
sSetpointsFileNameWithPath = ThisWorkbook.Path & "\" & CStr(Trim(Sheets(sSetpoints).Range("E2").Value)) & "_setpoints.csv" 这句话什么意思,主要是"_setpoints.csv" 这个什么意思,新手求解释
If Dir(sSetpointsFileNameWithPath) <> "" Then
On Error GoTo FileDeleteError:
Kill sSetpointsFileNameWithPath ' deletes the file if it exists
End If
DeleteCaseSetpointsFile = True
Exit Function
FileDeleteError:
MsgBox Sheets(sSetpoints).Range("E2").Value & "_setpoints.csv " & "File is not available for writing", vbInformation, ThisWorkbook.Name
End Function 展开
3个回答
展开全部
"_setpoints.csv" 就是文件名的后半部分啊。
ThisWorkbook.Path & "\" & CStr(Trim(Sheets(sSetpoints).Range("E2").Value)) & "_setpoints.csv"
首先“&”符号是连接符,用语字符串的连接。
这个文件的全路径就是 “当前Excel所在路径 + sSetpoints工作表的E2的值_setpoints.csv"
sSetpoints是个变量,比如sSetpoints等于Sheet1吧,而Sheet1的E2的值是”Point1“
那个这个文件名就是”Point1_setpoints.csv“。
ThisWorkbook.Path & "\" & CStr(Trim(Sheets(sSetpoints).Range("E2").Value)) & "_setpoints.csv"
首先“&”符号是连接符,用语字符串的连接。
这个文件的全路径就是 “当前Excel所在路径 + sSetpoints工作表的E2的值_setpoints.csv"
sSetpoints是个变量,比如sSetpoints等于Sheet1吧,而Sheet1的E2的值是”Point1“
那个这个文件名就是”Point1_setpoints.csv“。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询