Anastasios
08-08-2016, 03:01 PM
Hi all,
Sheet1 is protected from Workbook_Open() using: ThisWorkbook.Worksheets("Sheet").Protect Password:="Pass1", UserInterfaceOnly:=True.
A macro is trying to change the font size of Chart1's Axes label, using the following statement: ThisWorkbook.Worksheets("Sheet1").ChartObjects("Chart1").Chart.Axes(xlCategory).TickLabels.Font.Size = 10
and I get the following error:
Error: 1004.
Unable to set the Size property of the font class.
When I use the following workaround, the problem does not occur anymore:
ThisWorkbook.Worksheets("Sheet1").Unprotect "Pass1"
ThisWorkbook.Worksheets("Sheet1").ChartObjects("Chart1").Chart.Axes(xlCategory).TickLabels.Font.Size = 10
ThisWorkbook.Worksheets("Sheet1").Protect "Pass1"
But I want to avoid using Unprotect/Protect sheet that's why I choose to use ThisWorkbook.Worksheets("Sheet").Protect Password:="Pass1", UserInterfaceOnly:=True, which seems not to work for the particular case.
Any help is very much appreciated!!!
Sheet1 is protected from Workbook_Open() using: ThisWorkbook.Worksheets("Sheet").Protect Password:="Pass1", UserInterfaceOnly:=True.
A macro is trying to change the font size of Chart1's Axes label, using the following statement: ThisWorkbook.Worksheets("Sheet1").ChartObjects("Chart1").Chart.Axes(xlCategory).TickLabels.Font.Size = 10
and I get the following error:
Error: 1004.
Unable to set the Size property of the font class.
When I use the following workaround, the problem does not occur anymore:
ThisWorkbook.Worksheets("Sheet1").Unprotect "Pass1"
ThisWorkbook.Worksheets("Sheet1").ChartObjects("Chart1").Chart.Axes(xlCategory).TickLabels.Font.Size = 10
ThisWorkbook.Worksheets("Sheet1").Protect "Pass1"
But I want to avoid using Unprotect/Protect sheet that's why I choose to use ThisWorkbook.Worksheets("Sheet").Protect Password:="Pass1", UserInterfaceOnly:=True, which seems not to work for the particular case.
Any help is very much appreciated!!!