Dear all,
I'm intend to export data to excel file and disable the selection function on the worksheet, which is just in order to prevent users able to highlight the content and copy it to the other worksheet. And the code as following :
Set loApp = CreateObject("Excel.Application"
Set loExWB = loApp.Workbooks.Add
Set loExWS = loExWB.Worksheets(1)
loExWS.Cells(1, 1).Value = ...
loExWS.Cells(1, 2).Value = ...
...
With loExWS
.EnableSelection = xlNoSelection
.Protect Password:="abc", DrawingObjects:=True, Contents:=True, Scenarios:=True, UserInterfaceOnly:=True
End With
loApp.UserControl = True
loApp.Visible = True
Set loExWS = Nothing
Set loExWB = Nothing
Set loApp = Nothing
From the code, I already using loExWS.EnableSelection = xlNoSelection, but I still can highlight a range of cells in the worksheet, is it the real meaning of .EnableSelection.
Thanks alot
Aston
I'm intend to export data to excel file and disable the selection function on the worksheet, which is just in order to prevent users able to highlight the content and copy it to the other worksheet. And the code as following :
Set loApp = CreateObject("Excel.Application"
Set loExWB = loApp.Workbooks.Add
Set loExWS = loExWB.Worksheets(1)
loExWS.Cells(1, 1).Value = ...
loExWS.Cells(1, 2).Value = ...
...
With loExWS
.EnableSelection = xlNoSelection
.Protect Password:="abc", DrawingObjects:=True, Contents:=True, Scenarios:=True, UserInterfaceOnly:=True
End With
loApp.UserControl = True
loApp.Visible = True
Set loExWS = Nothing
Set loExWB = Nothing
Set loApp = Nothing
From the code, I already using loExWS.EnableSelection = xlNoSelection, but I still can highlight a range of cells in the worksheet, is it the real meaning of .EnableSelection.
Thanks alot
Aston