If Cells(3, 1) <> "" Then
ActiveWorkbook.SaveAs Filename:="\\192.168.1.77\a\rds\" & Mid(Cells(3, 1), 1, 4) & "认定书\(" & Sheet1.Cells(3, 1) & ")" & Sheet1.Cells(3, 2) & "认定.xls", FileFormat:=xlExcel8 _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.SaveAs Filename:="\\192.168.1.235\a\rds\" & Mid(Cells(3, 1), 1, 4) & "认定书\(" & Sheet1.Cells(3, 1) & ")" & Sheet1.Cells(3, 2) & "认定.xls", FileFormat:=xlExcel8 _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Close
########################################################
现在我想实现的是,在保存不到ip为235的这台电脑时,vba提示我“未能保存到235,建议手动保存”,然后继续运行下边的activeworkbook。。。。等。。
怎么加个这个样子的msgbox。。。
现在问题是,有时候235不开机,或者共享目录发生了变化,可能保存不上。一旦不存不上,代码就打住了,不往下进行了。
我想叫它提示下我,没保存上,然后,继续往下走。怎么写啊。
vba保存代码怎么加上这个功能。
答案:1 悬赏:20 手机版
解决时间 2021-02-28 01:38
- 提问者网友:無理詩人
- 2021-02-27 06:15
最佳答案
- 五星知识达人网友:纵马山川剑自提
- 2021-02-27 07:09
If Cells(3, 1) <> "" Then
ActiveWorkbook.SaveAs Filename:="\\192.168.1.77\a\rds\" & Mid(Cells(3, 1), 1, 4) & "认定书\(" & Sheet1.Cells(3, 1) & ")" & Sheet1.Cells(3, 2) & "认定.xls", FileFormat:=xlExcel8 _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
If Dir("\\192.168.1.235\a\rds\" & Mid(Cells(3, 1), 1, 4) & "认定书", vbDirectory) <> "" Then
ActiveWorkbook.SaveAs Filename:="\\192.168.1.235\a\rds\" & Mid(Cells(3, 1), 1, 4) & "认定书\(" & Sheet1.Cells(3, 1) & ")" & Sheet1.Cells(3, 2) & "认定.xls", FileFormat:=xlExcel8 _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Close
Else
MsgBox "“未能保存到235,建议手动保存!”"
End If
ActiveWorkbook.SaveAs Filename:="\\192.168.1.77\a\rds\" & Mid(Cells(3, 1), 1, 4) & "认定书\(" & Sheet1.Cells(3, 1) & ")" & Sheet1.Cells(3, 2) & "认定.xls", FileFormat:=xlExcel8 _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
If Dir("\\192.168.1.235\a\rds\" & Mid(Cells(3, 1), 1, 4) & "认定书", vbDirectory) <> "" Then
ActiveWorkbook.SaveAs Filename:="\\192.168.1.235\a\rds\" & Mid(Cells(3, 1), 1, 4) & "认定书\(" & Sheet1.Cells(3, 1) & ")" & Sheet1.Cells(3, 2) & "认定.xls", FileFormat:=xlExcel8 _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Close
Else
MsgBox "“未能保存到235,建议手动保存!”"
End If
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯