Compatibilité excel et windows nt

waspy59 Messages postés 189 Date d'inscription mercredi 24 novembre 2004 Statut Membre Dernière intervention 15 mai 2013 - 4 déc. 2005 à 22:02
waspy59 Messages postés 189 Date d'inscription mercredi 24 novembre 2004 Statut Membre Dernière intervention 15 mai 2013 - 5 déc. 2005 à 00:08
bonjour,

G un pettit prog pour convertir des données issu d'un automate et les archiver sous format excel, voici le code:

Dim i, j, val1 As Long

Dim valC1, valpatient, valmatrice, valdate, valheure, valanalyse, valresult As String

Set Myxlapp = Excel.Application

Myxlapp.Visible = False

Myxlapp.DisplayAlerts = False

temp = App.Path

temp2 = "archives912.xls"

Command2.Enabled = False

Workbooks.Open FileName:=temp & "" & temp2, Origin:=xlWindows

Columns("A:A").Select

Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _

:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _

False, SearchFormat:=False).Activate

i = ActiveCell.Row

val1 = 1

Workbooks.OpenText FileName:=a, Origin:=932, StartRow:=1 _

, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 2), Array(1, 2), Array(3, 2) _

, Array(12, 2), Array(26, 2), Array(42, 2), Array(61, 2)), TrailingMinusNumbers:=True

j = ActiveCell.SpecialCells(xlLastCell).Row

ProgressBar1.Min = 0

ProgressBar1.Max = j

Do

ProgressBar1.Value = val1

Label2.Caption = "en cours de traitement..."

Columns("C:C").Select

Range("C" & val1).Activate

Selection.Find(What:="-", After:=ActiveCell, LookIn:=xlFormulas, LookAt _

:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _

False, SearchFormat:=False).Activate

val1 = ActiveCell.Row

valpatient = Range("D" & val1)

valmatrice = Range("E" & val1)

valdate = Range("F" & val1)

Windows(temp2).Activate

If valdate = "" Then

i = i - 1

GoTo sautligne

Else

Range("A" & i) = valpatient

Range("B" & i) = valmatrice

Range("C" & i) = valdate

val1 = val1 + 2

End If

Windows(b).Activate

Do

If Range("B" & val1) = "" Then

valanalyse = Range("C" & val1)

valresult = Range("D" & val1)

End If

Windows(temp2).Activate

Rows("1:1").Select

On Error GoTo AddColumn

Err.Clear

Selection.Find(What:=valanalyse, After:=ActiveCell, LookIn:=xlFormulas, _

LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _

MatchCase:=False, SearchFormat:=False).Activate

GoTo JumpAddColumn

AddColumn:

Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, _

LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _

MatchCase:=False, SearchFormat:=False).Activate

valC1 = ActiveCell.Column

Cells(1, valC1) = valanalyse

Err.Clear

JumpAddColumn:

valC1 = ActiveCell.Column

Cells(i, valC1) = valresult

val1 = val1 + 1

sautligne:

Windows(b).Activate

Loop Until Range("B" & val1) "" And Range("C" & val1) ""

i = i + 1

Range("B" & val1).Activate

Loop Until val1 > j

Windows(b).Activate

ActiveWindow.Close

Columns("A:D").Select

With Selection

.HorizontalAlignment = xlGeneral

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Columns("A:A").Select

With Selection

.HorizontalAlignment = xlLeft

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Range("A1").Select

With Selection

.HorizontalAlignment = xlCenter

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Range("A1").Select

ActiveWorkbook.Save

ActiveWorkbook.Close

On Error GoTo Jumping1

Myxlapp.Visible = False

Myxlapp.DisplayAlerts = False

Myxlapp.Quit

Set Myxlapp = Nothing

Jumping1:

ProgressBar1.Value = 0

Label2.Caption = "traitement fini"

MsgBox "Archivage des données fini"

Command2.Enabled = True

Label2.Caption = ""



Ce programme a été développé sous vb6,
excel 11 et windows xp sp2 mais je dois utiliser ce prog avec un
windows nt4 et excel 97 ou supérieur.

Or le prog compilé ne fonctionne pas avec cette derniere config.... comment faire pour resoudre ce probleme.

2 réponses

cs_casy Messages postés 7741 Date d'inscription mercredi 1 septembre 2004 Statut Membre Dernière intervention 24 septembre 2014 40
4 déc. 2005 à 22:55
Qu'est-ce qu'il ne fonctionne pas exactement ? Ou c'est que ça plante ? le message d'erreur ?



Sans plus d'info, je dirais que la première solution, c'est de faire un
empaquetage complet sous XP pour ensuite faire une installation dans
les régles de l'art sous NT4.

Tu vas certainement integré des références à excel 2003, mais il est
possible qu'elles marchent avec excel 97. Par contre tu risque
peut-etre d'avoir des souci avec les fonctions systèmes utilisées avec
ton exe, elles ne sont pas forcement implémentées sous NT4 ou ont été
modifiées par XP ou le SP2.



Dans ce cas la seule solution, c'est de recompiler sous NT4, avec les DLL pour excel 97.


L'exe compilé sous NT4 devrais tourner sans trop de problème sous XP
(compatibilité ascendante). Pour excel, j'espere que microsoft nous a
assuré aussi une compatibilité ascendante. Au pire (c'est quand même
recommandé) tu fais un empaquetage NT4 et une installation correcte
sous XP et ça devrai tourner je pense.



Ne jamais oublié, généralement la compatibilité ascendante est assuré
dans la même famille de système (NT4 -> 2000 -> XP -> XPSP2),
par contre la compatibilité descendante c'est quelque fois "au petit
bonheur la chance" surtout chez notre cher ami Bilou



<hr size="2" width="100%">Si le cerveau était assez simple pour que nous puissions le comprendre,

nous serions assez bête pour ne pas le comprendre malgré tout.
0
waspy59 Messages postés 189 Date d'inscription mercredi 24 novembre 2004 Statut Membre Dernière intervention 15 mai 2013
5 déc. 2005 à 00:08
merci pour cette reponse rapide,



pour info g pas pensé a noté le message d'erreur et comme c installé chez un client je verrais ca los de ma prochaine visite.



Sinon je pense que l'idée d'un empaquetage complet est a creuser car
recompiler le programmer sous NT et excel 97 est impossible (chez
client).



donc on verra bien,



en tout cas encore merci pour ton aide
0
Rejoignez-nous