VBA比较常用共通方法(一)写文本文件续
来源:互联网 发布:软件停服通知 编辑:程序博客网 时间:2024/05/01 02:46
Public Function NewDir(ByVal strPath) As Boolean
Dim dirAttr As VbFileAttribute
dirAttr = vbNormal + vbDirectory + vbReadOnly
If Dir(strPath, dirAttr) <> "" Then
NewDir = True
Exit Function
End If
Dim Pos As Long
Dim strTemp As String
On Error Resume Next
Pos = InStr(1, strPath, "\")
While Pos > 0
strTemp = Left(strPath, Pos - 1)
If Dir(strTemp, dirAttr) = "" Then MkDir strTemp
Pos = InStr(Pos + 1, strPath, "\")
Wend
MkDir strPath
NewDir = (Dir(strPath, dirAttr) <> "")
If Err <> 0 Then Err.Clear
End Function
Public Sub SysErr(ByVal s As String)
If IsAutoRun Then Exit Sub
LimitMsgBoxText s
MsgBox s, vbCritical, "错误提示"
End Sub
Private Sub LimitMsgBoxText(s As String)
Const nMaxLen As Integer = 250
If Len(s) > nMaxLen Then s = Left(s, nMaxLen) & "..."
End Sub
Public Sub KillFile(strFile As String)
If Dir(strFile, vbHidden + vbNormal + vbReadOnly) <> "" Then
SetAttr strFile, vbNormal
Kill strFile
End If
End Sub
Dim dirAttr As VbFileAttribute
dirAttr = vbNormal + vbDirectory + vbReadOnly
If Dir(strPath, dirAttr) <> "" Then
NewDir = True
Exit Function
End If
Dim Pos As Long
Dim strTemp As String
On Error Resume Next
Pos = InStr(1, strPath, "\")
While Pos > 0
strTemp = Left(strPath, Pos - 1)
If Dir(strTemp, dirAttr) = "" Then MkDir strTemp
Pos = InStr(Pos + 1, strPath, "\")
Wend
MkDir strPath
NewDir = (Dir(strPath, dirAttr) <> "")
If Err <> 0 Then Err.Clear
End Function
Public Sub SysErr(ByVal s As String)
If IsAutoRun Then Exit Sub
LimitMsgBoxText s
MsgBox s, vbCritical, "错误提示"
End Sub
Private Sub LimitMsgBoxText(s As String)
Const nMaxLen As Integer = 250
If Len(s) > nMaxLen Then s = Left(s, nMaxLen) & "..."
End Sub
Public Sub KillFile(strFile As String)
If Dir(strFile, vbHidden + vbNormal + vbReadOnly) <> "" Then
SetAttr strFile, vbNormal
Kill strFile
End If
End Sub
- VBA比较常用共通方法(一)写文本文件续
- VBA比较常用共通方法(一)写文本文件
- JS的常用共通方法整理 2017109
- 常用共通
- VBA写txt文件--vba写RF文件--vbs写文本文件不同编码--vba写UTF8
- VBA 读写文本文件的几种方法
- VBA ADO常用方法
- java写文本文件类性能比较
- js check共通方法
- String 共通方法定义
- Wex5-共通方法-postRequest
- VBA中ADO常用方法
- VBA使用FileSystemObject将读取或写入文本文件(一)
- VBA使用FileSystemObject将读取或写入文本文件(一)
- VBA中常用对象的访问(一)
- VBA创建文本文件、读写文本文件
- VBA创建文本文件、读写文本文件
- vbs操作txt文本文件常用方法(函数)
- 诊断之美-芯片验证方法
- 2012年火车票攻略
- 过年感悟:快回家啦。博客得明年再来写东东了!
- java thread
- 哇!8款帮你轻松瘦脸的美食
- VBA比较常用共通方法(一)写文本文件续
- scsi调用流程
- asp.net无法访问UNC路径文件的解决
- android 异常 汇总
- 《天龙八部》观后感
- 【IE BUG】 CSS/HTML解决在IE6浏览器下显示文字重复
- android emulator snapshot
- 差分信号
- 将工作薄中的全部N张工作表都在sheet1中建上链接