请问,如果我用VB,想在D盘里创建文件夹名为KK,如果KK存在就创建kk1,如果kk1存在就创建KK2,依此类推..请高手贴出代码...万分感谢~~~~~~~~
那就从kk检查到kk10吧...
vb检查文件是否存在
答案:2 悬赏:60 手机版
解决时间 2021-02-10 01:58
- 提问者网友:低吟詩仙的傷
- 2021-02-09 13:33
最佳答案
- 五星知识达人网友:鱼芗
- 2021-02-09 14:42
嘿嘿,自己写了一个,调试通过:
Private Declare Function PathFileExists Lib "shlwapi.dll" Alias "PathFileExistsA" (ByVal pszPath As String) As Long
Public Sub Command1_Click()
Dim Path
Dim tPath
Dim i
Path = "d:\kk"
tPath = Path
i = 0
Do While PathFileExists(tPath)
i = i + 1
tPath = Path & i
Loop
If i <> 0 Then Path = Path & i
MkDir Path
MsgBox "创建文件夹“" & Path & "”成功"
End Sub
Private Declare Function PathFileExists Lib "shlwapi.dll" Alias "PathFileExistsA" (ByVal pszPath As String) As Long
Public Sub Command1_Click()
Dim Path
Dim tPath
Dim i
Path = "d:\kk"
tPath = Path
i = 0
Do While PathFileExists(tPath)
i = i + 1
tPath = Path & i
Loop
If i <> 0 Then Path = Path & i
MkDir Path
MsgBox "创建文件夹“" & Path & "”成功"
End Sub
全部回答
- 1楼网友:等灯
- 2021-02-09 16:11
private sub command1_click() web.navigate text1 end sub private sub web_documentcomplete(byval pdisp as object, url as variant) text2 = web.document.body.innerhtml if instr(text2, "无法访问") <> 0 or instr(text2, "无法显示") or instr(text2, "找不到页面") or instr(text2, "出错") then msgbox "不存在网页!" end sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯