VB & Excel gurus,
I am trying to unprotect an Excel worksheet with no avail. I have recorded a macro in Excel which displays the following code to unprotect the sheet:
ActiveSheet.Unprotect
I have used the object browser in VB to search for unprotect for the proper code in VB to do the same task and have found that the only option available to unprotect a worksheet is Excel.Worksheet.Unprotect ([password]). When this code is used I get "Method or data member not found!".
I also get error "Run Time Error 438, Object does not support this property or method" using the following code:
Private Sub cmdProcess_Click()
Dim ProcLoop As Integer
Dim xlapp As Excel.Application
Set xlapp = New Excel.Application
For ProcLoop = 0 To List1.ListCount - 1
xlapp.Workbooks.Open (List1.List(ProcLoop)), UpdateLinks = 0
xlapp.Worksheet.Unprotect ([wiring])
xlapp.ActiveWorkbook.Save
xlapp.Workbooks.Close
Next ProcLoop
xlapp.Quit
List1.Clear
MsgBox "Done!"
End Sub
Can anyone help?
Regards,
Bytehead
I am trying to unprotect an Excel worksheet with no avail. I have recorded a macro in Excel which displays the following code to unprotect the sheet:
ActiveSheet.Unprotect
I have used the object browser in VB to search for unprotect for the proper code in VB to do the same task and have found that the only option available to unprotect a worksheet is Excel.Worksheet.Unprotect ([password]). When this code is used I get "Method or data member not found!".
I also get error "Run Time Error 438, Object does not support this property or method" using the following code:
Private Sub cmdProcess_Click()
Dim ProcLoop As Integer
Dim xlapp As Excel.Application
Set xlapp = New Excel.Application
For ProcLoop = 0 To List1.ListCount - 1
xlapp.Workbooks.Open (List1.List(ProcLoop)), UpdateLinks = 0
xlapp.Worksheet.Unprotect ([wiring])
xlapp.ActiveWorkbook.Save
xlapp.Workbooks.Close
Next ProcLoop
xlapp.Quit
List1.Clear
MsgBox "Done!"
End Sub
Can anyone help?
Regards,
Bytehead