Passer de WRQ reflection à Excel et revenir à WRQ Reflection

cs_kouki69 Messages postés 95 Date d'inscription lundi 27 mars 2006 Statut Membre Dernière intervention 28 août 2015 - 27 août 2009 à 15:10
cs_kouki69 Messages postés 95 Date d'inscription lundi 27 mars 2006 Statut Membre Dernière intervention 28 août 2015 - 27 août 2009 à 17:44
Bonjour,

Voilà, grâce à l'aide de Renfield, j'ai pu avancé dans mon code et passer de Reflection à Excel.
Le problème que j'ai maintenant c'est revenir à WRQ Reflection sans quitter excel car j'ai besoin d'y retourner par la suite.

Le début du code est ci-dessous :

Dim oBook As Object
Dim oReflection As Object

Set oExcel = GetObject(, "Excel.Application")

oExcel.Visible = True

Set oBook = oExcel.Workbooks.Open(fileName:="c:\ fichier.xls")
Ce que je pense faire pour revenir à WRQ reflection est décrit ci-dessous, mais il semble que Reflexion.application ne lui dit trop rien...qu'est ce que je dois lui mettre ??


Set oReflection = GetObject(, "Reflection.Application")

Merci

2 réponses

Renfield Messages postés 17287 Date d'inscription mercredi 2 janvier 2002 Statut Modérateur Dernière intervention 27 septembre 2021 71
27 août 2009 à 17:15
gaffe a ton
Set oExcel = GetObject(, "Excel.Application")
ne va que si excel est lancé

je piges pas trop ton souci...
tu peux toujous manipuler ta Session, même avec Excel lancé...

(j'ai pas reflection sous la main avant mercredi...)


Renfield - Admin CodeS-SourceS - MVP Visual Basic
0
cs_kouki69 Messages postés 95 Date d'inscription lundi 27 mars 2006 Statut Membre Dernière intervention 28 août 2015
27 août 2009 à 17:44
Tu as raison, le souci n'est pas là puisque finalement, j'arrive bien à revenir sur Reflection, étant donné que je fais ma copie d'écran de reflection et que celà fonctionne (en rouge ci-dessous). Le pb est ailleur alors, car à partir de line1, il bloque ... ???

On Local Error Resume Next
Dim oExcel As Object
Dim oBook As Object
Dim oReflection As Object
Dim sFileName As String
Dim sFilePath As String
Dim i, j, a As String
Dim message As String

With Session
.WaitForEvent rcEnterPos, "30", "0", 20, 20
.WaitForDisplayString "RESPONSE:", "30", 20, 10
.TransmitANSI "SC"
sFileName = Trim$(.GetDisplayText(4, 11, 19))
End With

Set oExcel = GetObject(, "Excel.Application")
If Nothing Is oExcel Then
Set oExcel = CreateObject("Excel.Application")
End If
On Local Error GoTo 0

oExcel.Visible = True

Set oBook = oExcel.Workbooks.Open(fileName:="c:\suivi fichier.xls")

a = Cells(17, 2)
i = 17
j = 2

Do While Cells(i, j) <> ""
i = i + 1
Loop

Cells(i, j) = sFileName

sFilePath = "G:\fiches CNE" & sFileName & ".bmp"
SaveDisplay rcGraphicsAndText, rcOverwrite, sFilePath, rcBitmapColor, rcBlackBkgrnd'

GoTo Line1

'Line1:

' With Session
' .WaitForEvent rcEnterPos, "30", "0", 20, 22
' .WaitForDisplayString "SC", "30", 20, 20
' .TransmitTerminalKey rcIBMPf6Key

With Session

message = Trim$(.GetDisplayText(23, 11, 22))

End With

oExcel.Visible = False

If message = "CURRENT DATA" Then
GoTo Line2
Else: GoTo Line3

Line2:

With Session
.WaitForEvent rcEnterPos, "30", "0", 20, 20
.WaitForDisplayString "RESPONSE:", "30", 20, 10
.TransmitANSI "SC"
sFileName = Trim$(.GetDisplayText(4, 11, 19))
End With

oExcel.Visible = True

'Set oBook = oExcel.Workbooks.Open(fileName:="\\drlehw12\groups$\Recip Machines\3- Drafting\1- Administration\10- Planning\2-suivi divers\suivi fichier ECN.xls")

'Faire +1 par rapport à cellule précédente
a = Cells(17, 2)
i = 17
j = 2

Do While Cells(i, j) <> ""
i = i + 1
Loop

Cells(i, j) = sFileName

sFilePath = "G:\Recip Machines\3- Drafting\1- Administration\10- Planning\2-suivi divers\fiches ECN" & sFileName & ".bmp"

SaveDisplay rcGraphicsAndText, rcOverwrite, sFilePath, rcBitmapColor, rcBlackBkgrnd
End If

Line3:End sub
0
Rejoignez-nous