Ver Mensaje Individual
  #3  
Antiguo 13-01-2010
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - Espańa
Posts: 18.307
Reputación: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Si no recuerdo mal, el propio excel tiene opciones para bloquear Celdas, accediendo desde el formato de Celda.
Para ello debes proteger la hoja completa y luego desbloquear todas las celdas excepto las que quieras bloquear.

Se trata de ver cómo loquear y desbloquear celdas desde Excel (formato) y cómo bloquear la hoja (método Protect).

Tal vez este código te pueda servir de ayuda.

Código Delphi [-]
var
  R1 : TOpExcelRange;
begin
  ....
  R1 := WS.Ranges.Add;
  R1.Address := 'A1';

  if CheckBox1.Checked then begin
    R1.AsRange.Locked :=  False; // Set the range (cell A1) to unlocked so
we can still edit it
    WS.AsWorksheet.Protect(EmptyParam, True, True, True, True, 0);
    ShowMessage('Worksheet protected...');
  end else begin
    R1.AsRange.Locked :=  True; // Set the range (cell A1) to the default
locked state
    WS.AsWorksheet.Unprotect(EmptyParam, 0);
    ShowMessage('Worksheet Unprotected...');
  end;
end;
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita