×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

open exel or. TXT from Attachmate

open exel or. TXT from Attachmate

open exel or. TXT from Attachmate

(OP)
hello,
I am looking for a code to open a. txt or Excel from a macro
gender

Sub Main
Open "\\c:010011\MyDocs\mot de passe\base.txt"
End Sub

thank you for all the response

ps. I spend a script or excel to Attachmate

' 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


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close