Merci beaucoup ;-)

Je ne connaissait pas le raccourci de M$ excel et la macro affectée à un raccourci clavier dans OOo c'est aussi efficace.

Philippe

Mitch a écrit :
Merci Francois, mais ta macro ne donne pas le résultat escompté; en effet (c'est peut-être spécifique à OOo Linux), date() ne renvoit que le jour - je me retrouve donc avec un spendide 27/01/1900.

La correction est simple:

sub InsertDateJour_simple()
dim oDoc as object
dim oCurrentCell as object
dim aService as string

oDoc = thisComponent
aService = "com.sun.star.sheet.SpreadsheetDocument"
if oDoc.supportsService( aService ) then
 oCurrentCell = oDoc.CurrentSelection
 oCurrentCell.NumberFormat = 36 'format date: 37 = court, 36 = long
 oCurrentCell.Value = Now()
 else
 msgbox( "Macro pour Calc uniquement", 64, "Traitement interrompu" )
end if
end sub

Pus qu'à l'affecter à un raccourci...

Mitch


[EMAIL PROTECTED] a écrit :
Bonjour,

lutch a écrit :
Bonjour,

sous Excel Ctrl+; insère la date courante comme valeur fixe. Ce n'est
pas un champ.

Je ne trouve pas de commande comparable dans Calc, à laquelle on
pourrait associer un raccourci clavier.
Macro ?


Quelque chose comme :

sub InsertDateJour_simple()
 dim oDoc as object
 dim oCurrentCell as object
 dim aService as string

 oDoc = thisComponent
 aService = "com.sun.star.sheet.SpreadsheetDocument"
 if oDoc.supportsService( aService ) then
  oCurrentCell = oDoc.CurrentSelection
  oCurrentCell.NumberFormat = 36 'format date: 37 = court, 36 = long
  oCurrentCell.Value = Date()
  else
  msgbox( "Macro pour Calc uniquement", 64, "Traitement interrompu" )
end if
end sub

Macro à placer dans la bibliothèque standard d'OOo et à affecter à une
combinaison de touche.

Francois Gatto

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Philippe TERRIEUX
Service de la Protection des Végétaux Martinique
Responsable de la Cellule Contrôles Phytosanitaires
-------------
Direction Agriculture Forêt de Martinique
Service de la Protection des Végétaux
Pointe des Sables    BP 438
97205 FORT DE FRANCE CEDEX
Tel : 05.96.70.30.03
Fax : 05.96.73.90.40
-------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Répondre à