Hello XL Guru,
I got no idea why my new work book not working. While the old workbook i used the same code is doing fine but not this.
When i test run on the macro, it kept showing message as titled mentioned above.![]()
Private Sub Workbook_Open() Dim wSheet As Worksheet For Each wSheet In Worksheets wSheet.Protect Password:="123", _ UserInterFaceOnly:=True Next wSheet End Sub Sub SaveScreeningWithNewName() Dim NewFN As Variant ' Copy Screening to a new workbook Sheets(Array("Screening", "Agent-Sea", "Agent-Air", "B.Confirmation", "S.I.", "HBL")).Copy ActiveSheet.Shapes.Range(Array("****")).Delete NewFN = "\\CYCHUA-PC\Users\Public\Documents\Agent Record\" & Sheets(1).Range("G1").Text & Sheets(1).Range("H2").Value & " " & Sheets(1).Range("c3").Text & ".xlsx" ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbook ActiveWorkbook.Close End Sub Sub NextScreening() Sheets(1).Range("h1").Value = Range("h1").Value + 1 End Sub Sub uncheck_all() Dim sh As Shape Application.ScreenUpdating = False For Each sh In ActiveSheet.Shapes If sh.Type = msoOLEControlObject Then If TypeName(sh.OLEFormat.Object.Object) = "CheckBox" Then sh.OLEFormat.Object.Object = False End If If sh.Type = msoFormControl Then If sh.FormControlType = xlCheckBox Then sh.OLEFormat.Object = False End If Next sh Application.ScreenUpdating = True End Sub Sub ClearUnlockedCells() Dim wks As Worksheet For Each wks In ThisWorkbook.Worksheets On Error Resume Next wks.UsedRange.Value = vbNullString Err.Clear: On Error GoTo -1: On Error GoTo 0 Next wks Set wks = Nothing End Sub
Greatly appreciated, if any1 would point out where my mistake is.
I understand that macro could not run on a protected sheets. After google for hours, i found this userinterface thingy, still no luck.











LinkBack URL
About LinkBacks
Register To Reply

Bookmarks