我有一个宏,它运行 14 个文件传输,并且 Relection Workspace 连接到 AS400 机器。当 Outlook 提醒启动时,我使用 Visual Basic 自动运行宏。它多年来一直运作良好。昨天,我买了一台新电脑,现在如果没有一些人工干预,宏就无法运行。宏运行第一次文件传输,然后卡住。
我在任务管理器中发现的是,当反射打开时,它会在应用程序中打开 Attachmate.Emulation.Frame (32) 位。通常,当宏关闭反射时,此应用程序将关闭并且不再显示在任务管理器中。
在新机器上,这个应用程序没有关闭,宏无法继续。如果我在任务管理器中手动关闭应用程序,宏将继续。每次完成文件传输时,我都必须这样做。
以下是其中一种文件传输的代码:
Sub Branch_Admin_To_L_Regional_No_AUXRABAll_Closed()
Dim Session As Reflection.Session
Set Session = CreateObject("ReflectionIBM.Session")
Session.SetupSession rc5250Terminal, rc31792, rcTelnet
vUID400 = "A778833ODBA"
With Session
.SetNumeric rcXfr400Transport, rcLIPITCP
.SetString rcHostName, "CENTRAL"
.SetString rcAPPNNetID, ""
.SetString rcLocationName, ""
.SetString rcUserName, vUID400
.SetString rcPassword, vPW400
.SetNumeric rcSingleSignOn, rcNo
.SetNumeric rcTelnetUseSocks, rcNo
.SetString rcModeName, "QPCSUPP"
.SetString rcFQRemoteLu, ""
.SetString rcSNADomainSuffix, ""
.SetString rcMPTNIPAddress, ""
.SetNumeric rcXfrSpacesToUnderscores, rcYes
.SetNumeric rcXfrUnderscoresToSpaces, rcYes
.SetNumeric rcXfrReceive8Dot3, rcNo
.SetNumeric rcXfr8Dot3FilenameCase, rcLowerCase
.SetNumeric rcXfr400ExistsAction, rcAppend
.SetNumeric rcXfr400UseDescriptionFile, rcYes
.SetNumeric rcXfr400SaveDescriptionFile, rcNo
.SetNumeric rcXfr400SendConversion, rcAS400DIF
.SetNumeric rcXfr400ReceiveConversion, rcAS400CommaDelim
.SetNumeric rcXfr400HostFileType, rcAS400Data
.SetNumeric rcXfr400Authority, rcAuthReadwrite
.SetNumeric rcXfr400RecordLength, rcAS400DefaultRecLen
.SetNumeric rcXfr400TimeFormat, rcAS400TimeDFT
.SetNumeric rcXfr400DateFormat, rcAS400DateDFT
.SetNumeric rcXfr400TimeSeparator, rcAS400Default
.SetNumeric rcXfr400DateSeparator, rcAS400Default
.SetNumeric rcXfr400IgnoreDecErrors, rcNo
.SetNumeric rcXfr400ReturnMissing, rcYes
.SetNumeric rcXfr400DecSep, rcAS400WinDefault
.SetNumeric rcXfr400OutputDest, rcAS400File
.SetString rcXfr400FileText, ""
.SetString rcXfr400MemberText, ""
.SetString rcXfr400SendDescFile, "R:\My Doc\pt101pup1.FDF"
.SetString rcXfr400ReceiveDescFile, "*.FDF"
.SetString rcXfr400LocalFile, "X:\NA\7799\branch_officesAll.csv"
.SetString rcXfr400RemoteFile, "ellib/offdrb, ellib/auxdrb, ellib/pt102p, ellib/pt100p, ellib/pt102p01,ellib/offwwd"
.SetString rcXfr400SortSeq, "*JOB"
.SetString rcXfr400RefFile, ""
.SetNumeric rcXFR400Objects, rcRepMemberConf
.SetNumeric rcXfr400ShowProgress, rcYes
.SetNumeric rcXfr400Charset, rcAS400ANSICS
.SetNumeric rcXfr400DeleteTrailingSpaces, rcYes
.SetString rcXfrCurrentDirectory, "R:\my documents"
.SetNumeric rcXfr400StartRecord, rcDefaultStartRecord
.SetNumeric rcXfr400NCS, rcUSEnglish
.SetNumeric rcXfr400CompatibleFDFFile, rcNo
.SetNumeric rcXfr400AssumePositiveNumerics, rcNo
.SetString rcAS400LinkName, ""
.SetNumeric rcXfr400HostTP, rcLIPI
.SetNumeric rcXfr400ForceHexConversion, rcYes
.SetNumeric rcXfr400CompatibleAsciiFile, rcNo
.SetNumeric rcXfrCloseDlgAfterTransfer, rcNo
'.SetSQLStatement rcAS400Select, "t1.ODBGP, t1.ODBBR, t4.PT0GPT, t4.PT0BU, t3.PT2DPT, t3.PT2PRD, t1.ODBRGN, CONCAT(t1.ODBRGN, t1.ODBRGN) , t5.PT2DPT, t5.PT2PRD, t"
.SetSQLStatement rcAS400Select, "t1.ODBGP, t1.ODBBR, t4.PT0GPT, t4.PT0BU, t3.PT2DPT, t3.PT2PRD, t1.ODBRGN, t1.ODBRGN||t1.ODBRGN, t5.PT2DPT, t5.PT2PRD, t"
.AppendSQLStatement rcAS400Select, "1.ODBMID, t1.ODBBAC, t1.ODBBAD, t6.WWOSRG, t6.WWOCTC, t6.WWOARE,t1.ODBBDR,t1.ODBSTS"
.SetSQLStatement rcAS400Where, "t1.ODBRGN <> ' ' AND t2.AUXRAB = ' ' AND (t1.ODBBDR = 'N' and t1.ODBBLE = 'N' and t1.ODBBSE = 'N' and t1.ODBBUC = 'N' "
.AppendSQLStatement rcAS400Where, "and t1.ODBBAD = 'N' and t1.ODBBWH = 'N' and t1.ODBBAC = 'N') "
.SetSQLStatement rcAS400OrderBy, "t1.ODBGP , t1.ODBBR"
.SetSQLStatement rcAS400GroupBy, ""
.SetSQLStatement rcAS400Having, ""
.SetSQLStatement rcAS400JoinBy, "t1.ODBGP = t2.AUXGP AND t1.ODBGP = t3.PT2OGP AND t1.ODBBR = t2.AUXBR AND t1.ODBBR = t3.PT2OBR AND t1.ODBGP = t4.PT0OGP AND t2."
.AppendSQLStatement rcAS400JoinBy, "AUXGP = t5.PT2OGP AND CONCAT(t1.ODBRGN,t1.ODBRGN) = t5.PT2OBR AND t1.ODBGP = t6.WWOGRP AND t1.ODBBR = t6.WWOBRN"
.SetNumeric rcXfr400ExistsAction, rcAppend
.XfrCurrentDirectory = "R:\my doc"
.Xfr400RemoteFile = "ellib/offdrb,ellib/auxdrb,ellib/pt102p,ellib/pt100p,ellib/pt102p01,ellib/offwwd"
.Xfr400LocalFile = "F:\Groups\\AutoMonarch\Translate\branch_officesAll.csv"
.PCSReceiveFile "", True
.Exit
End With
End Sub
你看有什么不对吗?我检查了新旧机器上的引用,它们是相同的。我不确定从这里去哪里或下一步要尝试什么。谢谢你的帮助......