Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extract Several Columns of Data to Excel 2

Status
Not open for further replies.

SuperKoopa

Technical User
Jul 30, 2012
26
US
Good Afternoon!

Here's what I'm trying to accomplish:

There is an Attachmate screen with 5 columns of data on each page. There are several pages navigated to using F8. Each colomn of data has several rows of data that must remain in line. Example:

12/12/12
11/15/11
123
00.
YES
447.24...
...
..

And there are 19 rows of data for each column.I would like to move each columns data to an excel spreadsheet while keeping all of the data in order. I would like each Attachmate data column to have its own Excel column.

I've tried it 2 different ways.

The first way I tried to isolate each column of data using get string for the length of the data for the column and move it to excel. Not only was it time consuming, it wasn't reliable.

The second way which I'm currently messing with is copying the column data as long rows of data, using getstring to map each page to one single coloumn in excel and then using text to columns to order it properly. I feel as though I'm almost there. My main issue lies in the fact that Text to columns will not function properly. I can get it only to account for column A in Excel. Each Attachmate column will take up 10 Excel columns after Text To Columns is complete so in the loop as well I've included +10 to write the next F8 Page of 5 columns to the 10th Excel column and then use Text to columns and start the process over again untill all pages are completed.

After Excel column a has Text to columns applied to it, it works, but when the code loops to map the 2nd page of columns to excel column K, it gets the data just fine, but does not apply text to columns. Here is the code I am currently using. Any areas that you see can help me out I would absolutely appreciate it!
--------------------------------------------------------------------------------------------------------------

Sub Fillfigs()
' Get the main system object
Dim Sessions As Object
Dim I As Integer
Dim System As Object
Set System = CreateObject("EXTRA.System") ' Gets the system object
If (System Is Nothing) Then
MsgBox "Could not create the EXTRA System object. Stopping macro playback."
Stop
End If
Set Sessions = System.Sessions
If (Sessions Is Nothing) Then
MsgBox "Could not create the Sessions collection object. Stopping macro playback."
Stop
End If

' Set the default wait timeout value
ag_HostSettleTime = 5 ' milliseconds
OldSystemTimeout& = System.TimeoutValue
If (ag_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = ag_HostSettleTime
End If
' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
If (Sess0 Is Nothing) Then
MsgBox "512 Session is not open! Please open login to MSP and try again."
Stop
End If
If Not Sess0.Visible Then Sess0.Visible = True
Sess0.Screen.WaitHostQuiet (ag_HostSettleTime)
' Declare variables to contain the OLE objects
Dim objExcel As Object
Dim objWorkBook As Object
Dim gs As String
Dim r As Integer
Dim j As Integer
r = 1

On Error Resume Next

' Attempt to get a reference to an open instance of Excel
Set objExcel = GetObject(, "Excel.Application")
If objExcel Is Nothing Then
'If GetObject failed, open a new instance of Excel
Set objExcel = CreateObject("Excel.Application")
If objExcel Is Nothing Then
MsgBox ("Could not open Excel.")
Exit Sub
End If
End If

' Make Excel visible on the screen
objExcel.Visible = True

' Create a new Workbook
Set objWorkBook = objExcel.ActiveWorkbook

'THE CODE ABOVE IS JUST WHAT I COPY/PASTE TO USE WHEN TESTING A SNIPPET OF CODE FROM A BROADER PROJECT


'***************
'PULL FIGURES
'***************

With objWorkBook.Sheets("Sheet1")


acol = .Cells(, "A").Column

Do
lRow = .Cells(4, acol) + 4


For z = 6 To 20
Sess0.Screen.WaitHostQuiet (ag_HostSettleTime)
FIGS = Sess0.Screen.GetString(z, 11, 69)
.Cells(lRow, acol).Value = FIGS

lRow = z

.Cells(lRow, acol).Select
Selection.TextToColumns Destination:=Range("A4"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(2, 1), Array(14, 1), Array(16, 1), Array(28, 1), _
Array(30, 1), Array(42, 1), Array(44, 1), Array(56, 1), Array(58, 1), Array(70, 1), Array( _
72, 1)), TrailingMinusNumbers:=True
Columns("A:A").Select


If z = 20 Then acol = acol + 10

Next z

Sess0.Screen.SendKeys ("<PF8>")


If Sess0.Screen.GetString(23, 20, 4) = "PRESS" Then Exit Do
Loop Until Sess0.Screen.GetString(4, 68, 3) = "xxxx" 'not referenceing anything in particular, just waiting until the IF above become TRUE
End With

End Sub


 
The first way I tried to isolate each column of data using get string for the length of the data for the column and move it to excel. Not only was it time consuming, it wasn't reliable.

why was this time consuming and not reliable?

what row/col does each column begin? are they consistent?
 
hi,

A PICTURE is worth a THOUSAND words in many cases. Foe instance, it would be VERY helpful to 'see' your screen like, using the PRE TGML tag (the ROW & COL [left-top-bottom] help not only me, but also YOU)...

[pre]
----+---10----+---20----+---30----+---40----+---50----+---60----+---70----+---80
01 BILU2610 BIWEEKLY INDIRECT LABOR UPDATE 11/27/12 06:40:07
02 AUTH
03 CLOCK EMPLOYEE NAME DATE SCROLL? APPROVALS EWW
04 36250 CG METZGER 113012 N SUPV: HRS
05 SHIFT: 1 WS: 508 DEPT: 2W REPORTS TO: EWW : 00
06 DLN/ COM EMPL:
07 TC SUNDRY BUS WO TITLE SAT SUN MON TUE WED THU FRI PAID HOURS
08 ASSIGNED WORKWEEK 00 00 08 08 08 08 08
09 OVERRIDE WORKWEEK CLK
10 WO5 TRAINING 8.0
11 66A 8.0 8.0 8.0 8.0
12
13
14
15
16
17
18 STRAIGHT TIME 8.0 8.0 8.0 8.0 8.0 40.0
19 EWW
20 UNCOMP
21
22 END OF DATA FOR EMPLOYEE EWW APPROVAL PENDING
23 PFKEY 1:BIEX 2:WILU 11:BWIN 12:CODES 13:LOGOFF
24 NEXT PF24
----+---10----+---20----+---30----+---40----+---50----+---60----+---70----+---80
[/pre]


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
So on this particular screen there are 5 columns of data with 15 rows. Each of these columns appear on a fixed area of the page and each row in each column contains 13 spaces of data or reserved space for data. So they would be positioned like this:

POSITION ON PAGE:'Column 1 Column 2 Column 3 Column 4 Column 5
'12-24 (13 spaces) 26-38 (13 spaces) 40-52 (13 spaces) 54-66 (13 spaces) 68-80 (13 spaces)
(z, 12, 13) (z, 26, 13) (z, 40, 13) (z, 54, 13) (z, 66, 13)

EXAMPLE DATA TO BE PULLED:12/12 /12 11/12/12
11/15/11 10/15/11
123 126
00. 00.
YES NO
447.24... 751.20...
... ...
.. ..
 
GOODNESS! That didn't format at ALL like I typed it.

So on this particular screen there are 5 columns of data with 15 rows. Each of these columns appear on a fixed area of the page and each row in each column contains 13 spaces of data or reserved space for data. So they would be positioned like this:

POSITION ON PAGE:

'Column 1.................Column 2...........................Column 3................Column 4.................Column 5
'12-24 (13 spaces).....26-38 (13 spaces).....40-52 (13 spaces).....54-66 (13 spaces).....68-80 (13 spaces)
(z, 12, 13)............(z, 26, 13)...........(z, 40, 13)...........(z, 54, 13)...........(z, 66, 13)

EXAMPLE DATA TO BE PULLED:

12/12 /12........11/12/12
11/15/11.........10/15/11
123..............126
00...............00.
YES..............NO
447.24...........751.20...
... ...
.. ..
 
geez, my ACTUAL COPY does not look ANYTHING like your..... actual copy???? Oh, maybe it wuzznt!

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Skip,

[PRE] FIGS PH 00000000000 AMOUNT HISTORY 11-26-12
NAME J SMITh INV-LN xxx-xxx-xxxxxxxxx DUE 08-15-09 TYPE 19
BR 18 MAN A P-TYPE 0 INT .0176000 FIRST PB xxx,xxx.xx 2ND PB .00
HUD .00 NET 2095.95 SF .00000000 SUSP 6566.44 STOP D B P F N A D L
REP .00 RES .00 2 0 0 0 1 3 0 1
DATE1 11-25 11-23 11-01 11-01 11-01
DATE2 08-12 11-12 08-12 08-12 08-12
TYPE/TRAN 161 312 173 172 147
AMOUNT 1,717.67 2,985.26- 2,220.34 2,219.86 .00
PAID .00 .00 .00 .00 463.74-
OWED 174,927.06 279,828.06 215,928.26 371,125.06 863,521.04
FIG1 .00 .00 .00 .00 1,016.58-
FIG2 1,717.67 2,985.26- .00 .00 546.40-
FIG3 .00 1,717.67- 1,267.59 1,267.59 1,567.59
FIG4 .00 .00 .00 .00 .00
FIG5 .00 .00 .00 .00 .00
FIG6 .00 .00 .00 .00 1 63.62-
FIG7 .00 .00 .00 .00 .00
FIG8 1,707.67 .00 .00 .00 .00
FIG9 .00 .00 2,220.34 2,219.86 .00
TRANS NM 04037 * *

PAGE 001 OF 013 TOTAL TRANS AVAILABLE 0085 OLDEST TRAN 01-05-09 /P [/PRE]
 
Yeah sorry, I was already in the process of typing by the time you had responded. Had no idea of your request until I had submitted. But as you request sir, the actual screen itself. Understandably, the format is the same, but confidential information redacted.
 
Thanx!

Your Text to columns has 12. I only see 6! for rows from DATE1 to TRANS.
Code:
Array(
  Array(0, 1)
, Array(11, 1)
, Array(23, 1)
, Array(39, 1)
, Array(51, 1)
, Array(65, 1))
Take care with the 2 date rows. Excel will CONVERT the text to dates using the current year, unless you want to keep the TEXT. Then make the parsing result in TEXT for ALL values.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Ahhh! Thank you! So now I have the 1st column formatting properly. After text to columns it takes up excel columns A-E, which is perfect. Now the next column in Attachmate gets placed in F, which is great, but it wont do text to columns since I don't know how to account for the 'next' column in the loop I guess. Would you be able to help with this?

[PRE]
acol = .Cells(, "A").Column

Do
lRow = .Cells(4, acol) + 4

For z = 6 To 20
Sess0.Screen.WaitHostQuiet (ag_HostSettleTime)
P309 = Sess0.Screen.GetString(z, 11, 69)
.Cells(lRow, acol).Value = P309

lRow = z

If z = 20 Then acol = acol + 5

Next z

Application.DisplayAlerts = False
[highlight #FCE94F]Range("A4:A19").Select
Selection.TextToColumns Destination:=Range("A4"), DataType:=xlFixedWidth, _[/highlight] FieldInfo:=Array(Array(0, 1), Array(14, 1), Array(28, 1), Array(42, 1), Array(56, 1), _
Array(70, 1)), TrailingMinusNumbers:=True

Sess0.Screen.SendKeys ("<PF8>")
If Sess0.Screen.GetString(23, 20, 4) = "PRESS" Then Exit Do

Sess0.Screen.WaitHostQuiet (ag_HostSettleTime)
Loop Until Sess0.Screen.GetString(4, 68, 3) = "xxxx"
End With

End Sub
[/PRE]
 
here's one method that i use
Code:
    rw = 4
    
    Do
        For z = 6 to 20
        
            col1 = sess.getstring(z,13,12)
            col2 = sess.getstring(z,27,12)
            col3 = sess.getstring(z,41,12)
            col4 = sess.getstring(z,55,12)
            col5 = sess.getstring(z,69,12)
            
            
            With xl.Worksheets("Sheet1")
                rw = rw + 1
                .range("a" & rw, "e" & rw).NumberFormat = "@"
                .range("a" & rw) = col1
                .range("b" & rw) = col2
                .range("c" & rw) = col3
                .range("d" & rw) = col4
                .range("e" & rw) = col5
            
            End with
    
        Next z
        
        sess.sendkeys("<pf8>")
    
        If Sess.GetString(23, 20, 4) = "PRESS" Then Exit Do
    
    Loop until sess.getstring(4,68,3) = "XXXX"
 
Would you happen to know how to have the column in the range automatically move to the next excel column as attachmate columns are extracted until there is no more data? Similar to the one for the rows, rw = rw + 1? I'm not sure how to do this...
 
you had the answer in your original code.[dazed]

here's how i do it.
Code:
    r = 4   'set the beginning row 
    c = 1   'set the beginning column 
    
    Do
        For z = 6 to 20
        
            col1 = sess.getstring(z,13,12)
            col2 = sess.getstring(z,27,12)
            col3 = sess.getstring(z,41,12)
            col4 = sess.getstring(z,55,12)
            col5 = sess.getstring(z,69,12)
            
            
            With xl.Worksheets("Sheet1")

                r = r + 1
                .range(.cells(r,c), .cells(r, c +4)).NumberFormat = "@"
                .cells(r,c)      = col1
                .cells(r,c + 1)  = col2
                .cells(r,c + 2)  = col3
                .cells(r,c + 3)  = col4
                .cells(r,c + 4)  = col5
            
            End with
    
        Next z
                
                r = 4           'reset the rowback to 4
                c = c + 5       'increase the column by 5, adjust as needed
 
'--------------------------------------------------------------------------------
'
' Déclarations des variables globales
Global g_HostSettleTime%
Global g_szPassword$

Sub valide()
'--------------------------------------------------------------------------------
' Cherche l'objet principal du système
Dim Sessions As Object
Dim System As Object
Set System = CreateObject("EXTRA.System") ' Cherche l'objet du système
If (System Is Nothing) Then
MsgBox "Impossible de créer l'objet du système EXTRA. L'exécution de la macro est interrompue."
Stop
End If
Set Sessions = System.Sessions

If (Sessions Is Nothing) Then
MsgBox "Impossible de créer l'objet de la collection Sessions. L'exécution de la macro est interrompue."
Stop
End If
'--------------------------------------------------------------------------------
' Définir la valeur du délai d'attente par défaut
g_HostSettleTime = 0 ' millisecondes

OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If

' Cherche les objets nécessaires pour la session

Dim NO_IMMA
NO_IMMA = Workbooks("remp refp").Sheets("valide").Range("b2").Value
Dim NO_COMPTE
NO_COMPTE = Workbooks("remp refp").Sheets("valide").Range("b3").Value
Dim KMS
KMS = Workbooks("remp refp").Sheets("valide").Range("b4").Value
Dim code1
code1 = Workbooks("remp refp").Sheets("valide").Range("b5").Value
Dim code2
code2 = Workbooks("remp refp").Sheets("valide").Range("b6").Value
Dim code3
code3 = Workbooks("remp refp").Sheets("valide").Range("b7").Value
Dim code4
code4 = Workbooks("remp refp").Sheets("valide").Range("b8").Value
Dim code5
code5 = Workbooks("remp refp").Sheets("valide").Range("b9").Value



Dim Sess0 As Object
SessName0$ = "TN3270_A.EDP"

Set Sess0 = Sessions.Item(SessName0$)
If Sess0 Is Nothing Then
Err = MsgBox(SessName0 + " n'est pas ouvert. Souhaitez-vous l'ouvrir ?", 1)
If 1 = Err Then
Err = 0
Set Sess0 = Sessions.Open(SessName0)
If Err Then
MsgBox ("Echec de l'ouverture " + SessName0 + ". Interruption de la simulation")
Stop
End If
ElseIf 2 = Err Then
Stop
Else
MsgBox ("Echec de l'ouverture " + SessName0 + ". Interruption de la simulation")
Stop
End If
End If
If Not Sess0.Visible Then Sess0.Visible = True
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)

Dim Sess1 As Object
SessName1$ = "TN3270_E.EDP"

Set Sess1 = Sessions.Item(SessName1$)
If Sess1 Is Nothing Then
Err = MsgBox(SessName1 + " n'est pas ouvert. Souhaitez-vous l'ouvrir ?", 1)
If 1 = Err Then
Err = 0
Set Sess1 = Sessions.Open(SessName1)
If Err Then
MsgBox ("Echec de l'ouverture " + SessName1 + ". Interruption de la simulation")
Stop
End If
ElseIf 2 = Err Then
Stop
Else
MsgBox ("Echec de l'ouverture " + SessName1 + ". Interruption de la simulation")
Stop
End If
End If
If Not Sess1.Visible Then Sess1.Visible = True
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)

Dim Sess2 As Object
SessName2$ = "TN3270_B.EDP"

Set Sess2 = Sessions.Item(SessName2$)
If Sess2 Is Nothing Then
Err = MsgBox(SessName2 + " n'est pas ouvert. Souhaitez-vous l'ouvrir ?", 1)
If 1 = Err Then
Err = 0
Set Sess2 = Sessions.Open(SessName2)
If Err Then
MsgBox ("Echec de l'ouverture " + SessName2 + ". Interruption de la simulation")
Stop
End If
ElseIf 2 = Err Then
Stop
Else
MsgBox ("Echec de l'ouverture " + SessName2 + ". Interruption de la simulation")
Stop
End If
End If
If Not Sess2.Visible Then Sess2.Visible = True
Sess2.Screen.WaitHostQuiet (g_HostSettleTime)

Dim Sess3 As Object
SessName3$ = "TN3270_D.EDP"

Set Sess3 = Sessions.Item(SessName3$)
If Sess3 Is Nothing Then
Err = MsgBox(SessName3 + " n'est pas ouvert. Souhaitez-vous l'ouvrir ?", 1)
If 1 = Err Then
Err = 0
Set Sess3 = Sessions.Open(SessName3)
If Err Then
MsgBox ("Echec de l'ouverture " + SessName3 + ". Interruption de la simulation")
Stop
End If
ElseIf 2 = Err Then
Stop
Else
MsgBox ("Echec de l'ouverture " + SessName3 + ". Interruption de la simulation")
Stop
End If
End If
If Not Sess3.Visible Then Sess3.Visible = True
Sess3.Screen.WaitHostQuiet (g_HostSettleTime)

Dim Sess4 As Object
SessName4$ = "TN3270_C.EDP"

Set Sess4 = Sessions.Item(SessName4$)
If Sess4 Is Nothing Then
Err = MsgBox(SessName4 + " n'est pas ouvert. Souhaitez-vous l'ouvrir ?", 1)
If 1 = Err Then
Err = 0
Set Sess4 = Sessions.Open(SessName4)
If Err Then
MsgBox ("Echec de l'ouverture " + SessName4 + ". Interruption de la simulation")
Stop
End If
ElseIf 2 = Err Then
Stop
Else
MsgBox ("Echec de l'ouverture " + SessName4 + ". Interruption de la simulation")
Stop
End If
End If
If Not Sess4.Visible Then Sess4.Visible = True
Sess4.Screen.WaitHostQuiet (g_HostSettleTime)

' Cette section du code contient les événements enregistrés.
Sess2.Screen.SendKeys ("<Enter><Pf10><Tab><Tab>")
Sess2.Screen.WaitHostQuiet (g_HostSettleTime)
Sess2.Screen.SendKeys (NO_IMMA)
Sess2.Screen.WaitHostQuiet (g_HostSettleTime)
Sess2.Screen.SendKeys ("<Enter><Tab>")

Sess2.Screen.WaitHostQuiet (g_HostSettleTime)
Sess2.Screen.SendKeys (NO_COMPTE)
Sess2.Screen.SendKeys ("<Enter><Enter><Enter>")

Sess2.Screen.WaitHostQuiet (g_HostSettleTime)
Sess2.Screen.SendKeys (KMS)
Sess2.Screen.SendKeys ("<Enter><Enter><Enter>")

Sess2.Screen.WaitHostQuiet (g_HostSettleTime)
Sess2.Screen.SendKeys (code1)

Sess2.Screen.WaitHostQuiet (g_HostSettleTime)
Sess2.Screen.SendKeys (code2)

Sess2.Screen.WaitHostQuiet (g_HostSettleTime)
Sess2.Screen.SendKeys (code3)

Sess2.Screen.WaitHostQuiet (g_HostSettleTime)
Sess2.Screen.SendKeys (code4)

Sess2.Screen.WaitHostQuiet (g_HostSettleTime)
Sess2.Screen.SendKeys (code5)


Sess2.Screen.SendKeys ("<Enter><Enter>")


System.TimeoutValue = OldSystemTimeout
End Sub


 
' Déclarations des variables globales
Global g_HostSettleTime%
Global g_szPassword$

Sub copier_masque_C()
'--------------------------------------------------------------------------------
' Cherche l'objet principal du système
Dim Sessions As Object
Dim System As Object
Set System = CreateObject("EXTRA.System") ' Cherche l'objet du système
If (System Is Nothing) Then
MsgBox "Impossible de créer l'objet du système EXTRA. L'exécution de la macro est interrompue."
Stop
End If
Set Sessions = System.Sessions

If (Sessions Is Nothing) Then
MsgBox "Impossible de créer l'objet de la collection Sessions. L'exécution de la macro est interrompue."
Stop
End If
'--------------------------------------------------------------------------------
' Définir la valeur du délai d'attente par défaut
g_HostSettleTime = 0 ' millisecondes

OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If

' Cherche les objets nécessaires pour la session
Dim Sess0 As Object
SessName0$ = "TN3270_A.EDP"

Set Sess0 = Sessions.Item(SessName0$)
If Sess0 Is Nothing Then
Err = MsgBox(SessName0 + " n'est pas ouvert. Souhaitez-vous l'ouvrir ?", 1)
If 1 = Err Then
Err = 0
Set Sess0 = Sessions.Open(SessName0)
If Err Then
MsgBox ("Echec de l'ouverture " + SessName0 + ". Interruption de la simulation")
Stop
End If
ElseIf 2 = Err Then
Stop
Else
MsgBox ("Echec de l'ouverture " + SessName0 + ". Interruption de la simulation")
Stop
End If
End If
If Not Sess0.Visible Then Sess0.Visible = True
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)

Dim Sess1 As Object
SessName1$ = "TN3270_E.EDP"

Set Sess1 = Sessions.Item(SessName1$)
If Sess1 Is Nothing Then
Err = MsgBox(SessName1 + " n'est pas ouvert. Souhaitez-vous l'ouvrir ?", 1)
If 1 = Err Then
Err = 0
Set Sess1 = Sessions.Open(SessName1)
If Err Then
MsgBox ("Echec de l'ouverture " + SessName1 + ". Interruption de la simulation")
Stop
End If
ElseIf 2 = Err Then
Stop
Else
MsgBox ("Echec de l'ouverture " + SessName1 + ". Interruption de la simulation")
Stop
End If
End If
If Not Sess1.Visible Then Sess1.Visible = True
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)

Dim Sess2 As Object
SessName2$ = "TN3270_B.EDP"

Set Sess2 = Sessions.Item(SessName2$)
If Sess2 Is Nothing Then
Err = MsgBox(SessName2 + " n'est pas ouvert. Souhaitez-vous l'ouvrir ?", 1)
If 1 = Err Then
Err = 0
Set Sess2 = Sessions.Open(SessName2)
If Err Then
MsgBox ("Echec de l'ouverture " + SessName2 + ". Interruption de la simulation")
Stop
End If
ElseIf 2 = Err Then
Stop
Else
MsgBox ("Echec de l'ouverture " + SessName2 + ". Interruption de la simulation")
Stop
End If
End If
If Not Sess2.Visible Then Sess2.Visible = True
Sess2.Screen.WaitHostQuiet (g_HostSettleTime)

Dim Sess3 As Object
SessName3$ = "TN3270_D.EDP"

Set Sess3 = Sessions.Item(SessName3$)
If Sess3 Is Nothing Then
Err = MsgBox(SessName3 + " n'est pas ouvert. Souhaitez-vous l'ouvrir ?", 1)
If 1 = Err Then
Err = 0
Set Sess3 = Sessions.Open(SessName3)
If Err Then
MsgBox ("Echec de l'ouverture " + SessName3 + ". Interruption de la simulation")
Stop
End If
ElseIf 2 = Err Then
Stop
Else
MsgBox ("Echec de l'ouverture " + SessName3 + ". Interruption de la simulation")
Stop
End If
End If
If Not Sess3.Visible Then Sess3.Visible = True
Sess3.Screen.WaitHostQuiet (g_HostSettleTime)

Dim Sess4 As Object
SessName4$ = "TN3270_C.EDP"

Set Sess4 = Sessions.Item(SessName4$)
If Sess4 Is Nothing Then
Err = MsgBox(SessName4 + " n'est pas ouvert. Souhaitez-vous l'ouvrir ?", 1)
If 1 = Err Then
Err = 0
Set Sess4 = Sessions.Open(SessName4)
If Err Then
MsgBox ("Echec de l'ouverture " + SessName4 + ". Interruption de la simulation")
Stop
End If
ElseIf 2 = Err Then
Stop
Else
MsgBox ("Echec de l'ouverture " + SessName4 + ". Interruption de la simulation")
Stop
End If
End If
If Not Sess4.Visible Then Sess4.Visible = True
Sess4.Screen.WaitHostQuiet (g_HostSettleTime)

' Cette section du code contient les événements enregistrés.
Sess3.Screen.Select(3, 1, 150, 150).Copy
Sess3.Screen.WaitHostQuiet (g_HostSettleTime)
Workbooks("remp refp").Activate
Sheets("tp1").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("VALIDE AGR").Select
Sess3.Screen.WaitHostQuiet (g_HostSettleTime)

System.TimeoutValue = OldSystemTimeout
End Sub


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top