Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Problème reconnaissance date française par macro

2 réponses
Avatar
Nathalie Reneleau
Bonjour,
Lors de l'importation d'un fichier texte contenant des dates au format
français par une macro, Excel ne reconnaît pas les dates (Il a le format
anglais) les transforme en date anglaise quand c'est possible ou les met en
texte sinon. les paramètres régionaux windows sont bien à date français
Evidemment pour corser le tout les dates ne sont pas toujours au même
endroitse
Comment spécifier à Excel que les dates sont correctes mais françaises ?
Merci de votre aide.
Nathalie

2 réponses

Avatar
Oliv'
*Nathalie Reneleau que je salut
a écrit *:
Bonjour,
Lors de l'importation d'un fichier texte contenant des dates au format
français par une macro, Excel ne reconnaît pas les dates (Il a le
format anglais) les transforme en date anglaise quand c'est possible
ou les met en texte sinon. les paramètres régionaux windows sont bien
à date français Evidemment pour corser le tout les dates ne sont pas
toujours au même endroitse
Comment spécifier à Excel que les dates sont correctes mais
françaises ? Merci de votre aide.
Nathalie


cela dépend de ta version d'excel

Voici un exemple

Private Sub reouvre()
'
' Macro2 Macro
' Macro enregistrée le 17/12/2003 par Olivier CATTEAU
VersExcel = Application.Version

nom_fichier = ActiveWorkbook.Name
fpath = ActiveWorkbook.Path
Workbooks(nom_fichier).Close SaveChanges:úlse
If VersExcel = "11.0" Then
xl2003
Else
If VersExcel = "10.0" Then
xl2003
Else
Workbooks.OpenText Filename:=fpath & "" & nom_fichier, Origin:=xlWindows,
_
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:úlse, Tab:úlse, Semicolon:úlse,
Comma:=True _
, Space:úlse, Other:úlse

End If
End If

'MsgBox VersExcel

End Sub



Private Sub xl2003()
Workbooks.OpenText Filename:=fpath & "" & nom_fichier, Origin:=xlWindows, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
Tab:úlse, Semicolon:úlse, Comma:úlse _
, Space:úlse, Other:=True, OtherChar:=",", local:=True,
ConsecutiveDelimiter:úlse

If Range("b1").Value <> "Client" Then
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited,
_
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:úlse,
Tab:úlse, _
Semicolon:úlse, Comma:=True, Space:úlse, Other:úlse, OtherChar
_
:=",", TrailingMinusNumbers:=True
End If
End Sub


--
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Have a nice day
Oliv'
Pour me joindre : http://cerbermail.com/?V8r2o1YHl4
les sites références:
Excel :http://www.excelabo.net http://xcell05.free.fr/
http://dj.joss.free.fr/
http://frederic.sigonneau.free.fr/ http://www.excel-vba-francais.com/
Word : http://faqword.free.fr/
Outlook : http://faq.outlook.free.fr/
les archives : http://groups.google.com/group/microsoft.public.fr.outlook
OE6 : http://www.faqoe.com/
Sql : http://sqlpro.developpez.com/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Avatar
Nathalie Reneleau
Merci Oliv
Je vais tester




*Nathalie Reneleau que je salut
a écrit *:
Bonjour,
Lors de l'importation d'un fichier texte contenant des dates au format
français par une macro, Excel ne reconnaît pas les dates (Il a le
format anglais) les transforme en date anglaise quand c'est possible
ou les met en texte sinon. les paramètres régionaux windows sont bien
à date français Evidemment pour corser le tout les dates ne sont pas
toujours au même endroitse
Comment spécifier à Excel que les dates sont correctes mais
françaises ? Merci de votre aide.
Nathalie


cela dépend de ta version d'excel

Voici un exemple

Private Sub reouvre()
'
' Macro2 Macro
' Macro enregistrée le 17/12/2003 par Olivier CATTEAU
VersExcel = Application.Version

nom_fichier = ActiveWorkbook.Name
fpath = ActiveWorkbook.Path
Workbooks(nom_fichier).Close SaveChanges:úlse
If VersExcel = "11.0" Then
xl2003
Else
If VersExcel = "10.0" Then
xl2003
Else
Workbooks.OpenText Filename:=fpath & "" & nom_fichier, Origin:=xlWindows,
_
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:úlse, Tab:úlse, Semicolon:úlse,
Comma:=True _
, Space:úlse, Other:úlse

End If
End If

'MsgBox VersExcel

End Sub



Private Sub xl2003()
Workbooks.OpenText Filename:=fpath & "" & nom_fichier, Origin:=xlWindows, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
Tab:úlse, Semicolon:úlse, Comma:úlse _
, Space:úlse, Other:=True, OtherChar:=",", local:=True,
ConsecutiveDelimiter:úlse

If Range("b1").Value <> "Client" Then
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited,
_
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:úlse,
Tab:úlse, _
Semicolon:úlse, Comma:=True, Space:úlse, Other:úlse, OtherChar
_
:=",", TrailingMinusNumbers:=True
End If
End Sub


--
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Have a nice day
Oliv'
Pour me joindre : http://cerbermail.com/?V8r2o1YHl4
les sites références:
Excel :http://www.excelabo.net http://xcell05.free.fr/
http://dj.joss.free.fr/
http://frederic.sigonneau.free.fr/ http://www.excel-vba-francais.com/
Word : http://faqword.free.fr/
Outlook : http://faq.outlook.free.fr/
les archives : http://groups.google.com/group/microsoft.public.fr.outlook
OE6 : http://www.faqoe.com/
Sql : http://sqlpro.developpez.com/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~