早上好
我继承了此发送密钥代码,其中A列包含名称,B列包含金额并更新应用程序金额,D列与宏配合使用,将名称从应用程序复制到工作表中,并使用E列确定是否A列中的名称= D列。我在F列中添加名称以在A列中使用该名称,并在末尾添加_Law。这部分很容易,我遇到的问题是现在使用我在F列中输入的内容,并使用它来更新名称的应用程序。下面是我的代码...
Sub CompleteSTARandExcelSendKeyCode()
'
' CompleteSTARandExcelSendKeyCode Macro
' Macro recorded 12/22/2010 by UMMS User
'
'
Dim EnterKey As String
Dim ThreeKey As String
Dim YesKey As String
Dim AccountKey As String
Dim rowkey As Integer
'-------------------
'AccountKey = "1620001739"
EnterKey = "~"
ThreeKey = "3"
YesKey = "Y"
rowkey = 1
Do
AppActivate ("Microsoft Excel - SendKey_UMMC.xls"), False
Application.Sheets("Accounts").Select
Range("A" & rowkey).Select
AccountKey = Range("A" & rowkey)
'================================================
'STAR Send Key Code
'================================================
'=============================================
'Select UMMC at the Facility Screen
'=============================================
AppActivate ("1 - HBOC_CLN"), False
Application.SendKeys (ThreeKey), True
Application.SendKeys (EnterKey), True
'Enter the account number
Application.Wait (Now + TimeValue("00:00:03"))
AppActivate ("1 - HBOC_CLN"), False
Application.SendKeys (AccountKey), True
Application.SendKeys (EnterKey), True
'Say Yes to Do you wnat to send charges for this account
Application.Wait (Now + TimeValue("00:00:03"))
AppActivate ("1 - HBOC_CLN"), False
Application.SendKeys (YesKey), True
Application.SendKeys (EnterKey), True
'Say Yes to Add account to HPM index tranferring changes
Application.Wait (Now + TimeValue("00:00:03"))
AppActivate ("1 - HBOC_CLN"), False
Application.SendKeys (YesKey), True
Application.SendKeys (EnterKey), True
'===========================================================
'End of the STAR Code
'===========================================================
rowkey = rowkey + 1
AppActivate ("Microsoft Excel - SendKey_UMMC.xls"), False
Application.Sheets("Accounts").Select
Range("A" & rowkey).Select
AccountKey = Range("A" & rowkey)
Application.Wait (Now + TimeValue("00:00:03"))
Dim c As Range
For Each c In Selection
If c.Value <> "" Then c.Value = c.Value & "_01"
Next
Loop Until AccountKey = "END"
End Sub