我想使用SaveCopyAs
而不是SaveAs
函数来保持原始文件打开。
Private Sub CommandButton6_Click()
Dim strName As String
Set wbA = ActiveWorkbook
Set wsA = ActiveSheet
strName = wsA.Range("B5").Value
Worksheets("Sheet1").Unprotect Password:=XXXXXX
If ActiveSheet.CheckBoxes.Count > 0 Then
ActiveSheet.CheckBoxes.Visible = True
ActiveSheet.CheckBoxes.Enabled = False
End If
Worksheets("Sheet1").CommandButton6.Visible = False
Worksheets("Sheet1").Protect Password:=XXXXXX
ThisWorkbook.SaveCopyAs Filename:="http://XXXXsharepoint pathXXX" & "/" &
strName & ".xlsm"
Worksheets("Sheet1").Unprotect Password:=XXXXXX
Worksheets("Sheet1").CommandButton6.Visible = False
Worksheets("Sheet1").Protect Password:=XXXXXX
End Sub
上面的代码给我一个1004错误。