我在 Excel 2010 中创建了一个简单的电子表格,其中包含一个在电子表格打开时加载的表单。员工填写所需的表单数据并使用 SaveAs 方法按下“保存”按钮宏。
我的问题是是否可以禁用已保存副本中的表单?原因是我想避免在我们的簿记部门打开副本查看数据时加载表单。
为了澄清这就是我的vba代码的方式
Sub SaveAsButton()
Dim applicationUserName As String
Dim saveLocation As String
Dim fileName As String
Dim weekNo As String
Dim year As String
weekNo = ThisWorkbook.Sheets("Service").Range("M4").Value
Debug.Print (weekNo)
year = ThisWorkbook.Sheets("Service").Range("R4").Value
Debug.Print (year)
applicationUserName = Application.UserName
Debug.Print (applicationUserName)
saveLocation = "w:\Service Users\" & applicationUserName & "\Service\"
Debug.Print (saveLocation)
fileName = "Service" & "-" & weekNo & "-" & year & "-" & applicationUserName
Debug.Print (fileName)
fileName = Replace(fileName, " ", "")
Debug.Print (fileName)
ThisWorkbook.SaveAs (saveLocation & fileName)
End Sub
谢谢你。