Mal*_*red 1 excel vba excel-vba
我尝试在线复制一些代码,我从下面链接中找到... http://www.ozgrid.com/forum/showthread.php?t=15325
我尝试使用一些代码通过我的Excel工作簿中的按钮导入图像,这段代码锁定了我的工作表,当它提示输入密码时,我试着点击输入而没有占优势......
我在下面使用的代码
Sub BrowsePicture()
Dim Pict
Dim ImgFileFormat As String
Dim PictCell As Range
Dim Ans As Integer
ActiveSheet.Protect True, True, True, True, True
ImgFileFormat = "Image Files (*.bmp),others, tif (*.tif),*.tif, jpg (*.jpg),*.jpg"
GetPict:
Pict = Application.GetOpenFilename(ImgFileFormat)
'Note you can load in any nearly file format
If Pict = False Then End
Ans = MsgBox("Open : " & Pict, vbYesNo, "Insert Picture")
If Ans = vbNo Then GoTo GetPict
'Now paste to userselected cell
GetCell:
Set PictCell = Application.InputBox("Select the cell to insert into", Type:=8)
If PictCell.Count > 1 Then MsgBox "Select ONE cell only": GoTo GetCell
PictCell.Select
ActiveSheet.Pictures.Insert(Pict).Select
End Sub
Run Code Online (Sandbox Code Playgroud)
请帮忙!我在这张电子表格中投入了大量的工作,我无法编辑任何东西:(
第一个参数ActiveSheet.Protect True, True, True, True, True是密码,因此您已将密码设置为True.(注意:不是"True",实际值True,您将无法从标准的unprotect对话框中输入.).
您可以通过执行命令再次取消保护
ActiveSheet.Unprotect True
Run Code Online (Sandbox Code Playgroud)
从立即窗口(或者你可以写一个小的Sub来做).
| 归档时间: |
|
| 查看次数: |
79 次 |
| 最近记录: |