Hi I've developed a macro to check on attachmate a list of payments collected from excell, the macro works in the respect that it opens the invoice and shows if payment has or hasn't been collected and will copy all the required info to and from attachmate and excell.
However I want it to bring up a msg box asking to proceed or cancel as if payment is showing click ok and macro continues if payment not there can click cancel and macro will stop.
Now the msg box part of the macro works in attachmatess .ebm but
isn't working in VB I would like to get Vb to recognise this part of code any help would be great.
Dim Excel As Object
Dim Session As Object
Dim MyScreen As Object
'--------------------------------------------------------------------------------
'Get Invoice number from Excel.
ActiveCell.Offset(1, 0).Select
Application.Goto Range("A" & ActiveCell.Row), True
ActiveCell.Select
ActiveCell.Copy
'--------------------------------------------------------------------------------
'Load Invoice.
AppActivate "NBBS-USER - EXTRA! X-TREME"
Sess1.Screen.SendKeys ("<Find>NBABA<Ctrl+M>")
Sess1.Screen.SendKeys ("NB50")
Sess1.Screen.Paste
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
Sess1.Screen.MoveTo 1, 15, 1
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
Sess1.Screen.SendKeys ("D<Ctrl+M>")
Begin Dialog UserDialog 125, 34, "Do You Wish to Proceed?"
ButtonGroup .ButtonGroup1
OKButton 5, 10, 54, 16
CancelButton 62, 10, 54, 16
End Dialog
Dim mydialog As UserDialog
On Error Resume Next
Dialog mydialog
If Err = 102 Then Stop
'--------------------------------------------------------------------------------
'Get Date Clear
Set MyScreen = Sess1.Screen
Set MyArea = MyScreen.Area(9, 3, 9, 10)
MyArea.Select
Sess1.Screen.Copy
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
'--------------------------------------------------------------------------------
'Put Date clear into the MS Excel Spread Sheet
Application.Goto Range("I" & ActiveCell.Row), True
ActiveCell.PasteSpecial
'--------------------------------------------------------------------------------
'Get Auth Code
Application.Goto Range("G" & ActiveCell.Row), True
ActiveCell.Copy
'--------------------------------------------------------------------------------
'Put note and Auth Code In Billing
Answer = MsgBox("Proceed?", _
vbOKCancel, "My Title")
If Answer = vbCancel Then Exit Sub ' the macro ends if the user selects the CANCEL-button
Sess1.Screen.SendKeys ("<Left>1<Ctrl+M>")
g_HostSettleTime = 0 ' milliseconds
Sess1.Screen.SendKeys ("INDAY PAYMENT TAKEN EPDQ - ")
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
Sess1.Screen.Paste
'--------------------------------------------------------------------------------
'Get Date Taken
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
Set MyScreen = Sess1.Screen
Set MyArea = MyScreen.Area(4, 10, 4, 27)
MyArea.Select
Sess1.Screen.Copy
'--------------------------------------------------------------------------------
'Put Date Taken In Billing
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
Application.Goto Range("H" & ActiveCell.Row), True
ActiveCell.Copy
Sess1.Screen.MoveTo 18, 56, 1
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
Sess1.Screen.Paste
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
Sess1.Screen.SendKeys ("AC")
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
End Sub
However I want it to bring up a msg box asking to proceed or cancel as if payment is showing click ok and macro continues if payment not there can click cancel and macro will stop.
Now the msg box part of the macro works in attachmatess .ebm but
isn't working in VB I would like to get Vb to recognise this part of code any help would be great.
Dim Excel As Object
Dim Session As Object
Dim MyScreen As Object
'--------------------------------------------------------------------------------
'Get Invoice number from Excel.
ActiveCell.Offset(1, 0).Select
Application.Goto Range("A" & ActiveCell.Row), True
ActiveCell.Select
ActiveCell.Copy
'--------------------------------------------------------------------------------
'Load Invoice.
AppActivate "NBBS-USER - EXTRA! X-TREME"
Sess1.Screen.SendKeys ("<Find>NBABA<Ctrl+M>")
Sess1.Screen.SendKeys ("NB50")
Sess1.Screen.Paste
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
Sess1.Screen.MoveTo 1, 15, 1
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
Sess1.Screen.SendKeys ("D<Ctrl+M>")
Begin Dialog UserDialog 125, 34, "Do You Wish to Proceed?"
ButtonGroup .ButtonGroup1
OKButton 5, 10, 54, 16
CancelButton 62, 10, 54, 16
End Dialog
Dim mydialog As UserDialog
On Error Resume Next
Dialog mydialog
If Err = 102 Then Stop
'--------------------------------------------------------------------------------
'Get Date Clear
Set MyScreen = Sess1.Screen
Set MyArea = MyScreen.Area(9, 3, 9, 10)
MyArea.Select
Sess1.Screen.Copy
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
'--------------------------------------------------------------------------------
'Put Date clear into the MS Excel Spread Sheet
Application.Goto Range("I" & ActiveCell.Row), True
ActiveCell.PasteSpecial
'--------------------------------------------------------------------------------
'Get Auth Code
Application.Goto Range("G" & ActiveCell.Row), True
ActiveCell.Copy
'--------------------------------------------------------------------------------
'Put note and Auth Code In Billing
Answer = MsgBox("Proceed?", _
vbOKCancel, "My Title")
If Answer = vbCancel Then Exit Sub ' the macro ends if the user selects the CANCEL-button
Sess1.Screen.SendKeys ("<Left>1<Ctrl+M>")
g_HostSettleTime = 0 ' milliseconds
Sess1.Screen.SendKeys ("INDAY PAYMENT TAKEN EPDQ - ")
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
Sess1.Screen.Paste
'--------------------------------------------------------------------------------
'Get Date Taken
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
Set MyScreen = Sess1.Screen
Set MyArea = MyScreen.Area(4, 10, 4, 27)
MyArea.Select
Sess1.Screen.Copy
'--------------------------------------------------------------------------------
'Put Date Taken In Billing
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
Application.Goto Range("H" & ActiveCell.Row), True
ActiveCell.Copy
Sess1.Screen.MoveTo 18, 56, 1
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
Sess1.Screen.Paste
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
Sess1.Screen.SendKeys ("AC")
Sess1.Screen.WaitHostQuiet (g_HostSettleTime)
End Sub