如何为不同的工作表创建多个密码?

时间:2017-06-18 12:55:00

标签: vba passwords

我想为工作表和拆分工作表创建多个密码,工作簿中的示例包括3个工作表,我想分成3个带有3个密码的excel文件(sheet1带密码" 123&#34 ;, sheet2带密码" 456",sheet3,密码为" 789")。

当我使用下面的代码时,我可以使用我想要的密码分割3个文件,但是所有三个页面的内容与最终页面相同,而不是每个相应表单的内容。

Sub Splitbook() Dim xPath As String xPath = Application.ActiveWorkbook.Path With Application .ScreenUpdating = False .DisplayAlerts = False End With For Each xWs In ThisWorkbook.Sheets xWs.Copy ActiveWorkbook.SaveAs Filename:=xPath & "\" & Sheet1.Name & ".xlsx", Password:="123" ActiveWorkbook.SaveAs Filename:=xPath & "\" & Sheet2.Name & ".xlsx", Password:="456" ActiveWorkbook.SaveAs Filename:=xPath & "\" & Sheet3.Name & ".xlsx", Password:="789" ActiveWorkbook.Close False Next With Application .DisplayAlerts = True .ScreenUpdating = True End With End Sub

有办法解决我的问题吗?请帮帮我!

谢谢,并致以最诚挚的问候。

0 个答案:

没有答案