Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Disable Selection for Excel File
Message
De
11/07/2003 06:17:29
 
 
À
Tous
Information générale
Forum:
Visual Basic
Catégorie:
Autre
Titre:
Disable Selection for Excel File
Divers
Thread ID:
00809126
Message ID:
00809126
Vues:
74
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
Répondre
Fil
Voir

Click here to load this message in the networking platform