Mike Eghtebas
asked on
Worksheet Protection
From vb 6, I want to send a worksheet to the end and password protect it:
1. Line: ws.Move after:=Sheets(Worksheets.C ount) errors: method 'Worksheets' of object '_Global' failed. error: 1004
2. I need code to protect the same worksheet.
3. I need code to unprotect this worksheet to edit its content and then protect it again.
Thanks.
1. Line: ws.Move after:=Sheets(Worksheets.C
2. I need code to protect the same worksheet.
3. I need code to unprotect this worksheet to edit its content and then protect it again.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try
ws.Move after:=Sheets(xlApp.Worksh eets.Count )
ws.Move after:=Sheets(xlApp.Worksh
ASKER
Erick37,
I will try your solution and reopen the question for a proper split.
Thanks.
I will try your solution and reopen the question for a proper split.
Thanks.
Sorry, your correct I'm in Excel mode. Erick37 is correct that should fix your problem.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Erick,
ws.Move after:=xlApp.Sheets(xlApp. Worksheets .Count)
Works. Could you opent this question or I need to get assistance from an EE Admin.
Mike
ws.Move after:=xlApp.Sheets(xlApp.
Works. Could you opent this question or I need to get assistance from an EE Admin.
Mike
ASKER
Public Sub test()
Dim xlApp As Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
Set xlApp =GetObject..
Setwb=xlApp.Workbooks(strW
Set ws = wb.Worksheets("ABC")
ws.Move after:=Sheets(Worksheets.C
Sheets(Worksheets.Count).P
End Sub