on 03-20-2018 12:44 PM
Hi
i wrote VBA module pull out the data from sapgui
but have a question, vba can't reading than 82 rows
Sub xff()
xf11 = 0
xf21 = 0
xf10 = 0
xf22 = 0
If Not IsObject(VBAPP) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set VBAPP = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(Connection) Then
Set Connection = VBAPP.Children(0)
End If
If Not IsObject(session) Then
Set session = Connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject VBAPP, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell").doubleClickNode "F00003"
session.findById("wnd[0]/usr/btnBUTTON6").press
session.findById("wnd[0]").sendVKey 17
session.findById("wnd[1]/usr/txtV-LOW").Text = "620"
session.findById("wnd[1]/usr/txtV-LOW").caretPosition = 3
session.findById("wnd[1]").sendVKey 8
session.findById("wnd[0]").sendVKey 8
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[1]/btn[18]").press
session.findById("wnd[0]/tbar[1]/btn[33]").press
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").setCurrentCell 5, "TEXT"
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").firstVisibleRow = 0
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").selectedRows = "5"
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").doubleClickCurrentCell
Set mygrid = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell")
xf11 = mygrid.RowCount
For xf10 = 1 To xf11
Cells(xf10, 1) = mygrid.getcellvalue(xf10 - 1, "VBELN")
Cells(xf10, 2) = mygrid.getcellvalue(xf10 - 1, "LGORT")
Cells(xf10, 3) = mygrid.getcellvalue(xf10 - 1, "NAME_WE")
Cells(xf10, 4) = mygrid.getcellvalue(xf10 - 1, "ZZTEXT")
Cells(xf10, 5) = mygrid.getcellvalue(xf10 - 1, "MATNR")
Cells(xf10, 6) = mygrid.getcellvalue(xf10 - 1, "ARKTX")
Cells(xf10, 7) = mygrid.getcellvalue(xf10 - 1, "S_MEINS")
Cells(xf10, 😎 = mygrid.getcellvalue(xf10 - 1, "S_LGMNG")
Cells(xf10, 9) = mygrid.getcellvalue(xf10 - 1, "VOLUM")
Cells(xf10, 10) = mygrid.getcellvalue(xf10 - 1, "BRGEW")
Cells(xf10, 11) = mygrid.getcellvalue(xf10 - 1, "WBSTK")
Cells(xf10, 12) = mygrid.getcellvalue(xf10 - 1, "WADAT")
Cells(xf10, 13) = mygrid.getcellvalue(xf10 - 1, "LFDAT")
Cells(xf10, 14) = mygrid.getcellvalue(xf10 - 1, "WERKS")
Cells(xf10, 15) = mygrid.getcellvalue(xf10 - 1, "ORT01_WE")
Cells(xf10, 16) = mygrid.getcellvalue(xf10 - 1, "VRKME")
Cells(xf10, 17) = mygrid.getcellvalue(xf10 - 1, "S_VGBEL")
Cells(xf10, 18) = mygrid.getcellvalue(xf10 - 1, "S_CHARG")
Cells(xf10, 19) = mygrid.getcellvalue(xf10 - 1, "VSTEL")
Cells(xf10, 20) = mygrid.getcellvalue(xf10 - 1, "VKORG")
Cells(xf10, 21) = mygrid.getcellvalue(xf10 - 1, "KODAT")
Next xf10
/ ----------------------------------------------------------
hi Script Man thank for you reply
I add the: xf00=err.number ----- new problem coming I can't pull out the data.
..................................................................................................................................................................................
Sub xaa()
xf11 = 0
xf21 = 0
xf10 = 0
xf22 = 0
xf30 = 0
xf31 = 0
xf32 = 0
xf00 = 0
If Not IsObject(VBAPP) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set VBAPP = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(Connection) Then
Set Connection = VBAPP.Children(0)
End If
If Not IsObject(session) Then
Set session = Connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject VBAPP, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell").doubleClickNode "F00003"
session.findById("wnd[0]/usr/btnBUTTON6").press
session.findById("wnd[0]").sendVKey 17
session.findById("wnd[1]/usr/txtV-LOW").Text = "310"
session.findById("wnd[1]/usr/txtENAME-LOW").Text = ""
session.findById("wnd[1]/usr/txtV-LOW").caretPosition = 3
session.findById("wnd[1]").sendVKey 8
session.findById("wnd[0]").sendVKey 8
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[1]/btn[18]").press
'&&&&&&&&&&&&&如果没有查询结果,则执行不同的条件语句&&&&&&&
On Error Resume Next
session.findById("wnd[0]/tbar[1]/btn[33]").press
xf00 = Err.Number
If xf00 = 0 Then
On Error GoTo 0
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").firstVisibleRow = 0
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").selectedRows = "5"
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").doubleClickCurrentCell
Set mygrid = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell")
xf11 = mygrid.RowCount
For xf10 = 1 To xf11
Cells(xf10, 1) = mygrid.getcellvalue(xf10 - 1, "VBELN")
Cells(xf10, 2) = mygrid.getcellvalue(xf10 - 1, "LGORT")
Cells(xf10, 3) = mygrid.getcellvalue(xf10 - 1, "NAME_WE")
Cells(xf10, 4) = mygrid.getcellvalue(xf10 - 1, "ZZTEXT")
Cells(xf10, 5) = mygrid.getcellvalue(xf10 - 1, "MATNR")
Cells(xf10, 6) = mygrid.getcellvalue(xf10 - 1, "ARKTX")
Cells(xf10, 7) = mygrid.getcellvalue(xf10 - 1, "S_MEINS")
Cells(xf10, 😎 = mygrid.getcellvalue(xf10 - 1, "S_LGMNG")
Cells(xf10, 9) = mygrid.getcellvalue(xf10 - 1, "VOLUM")
Cells(xf10, 10) = mygrid.getcellvalue(xf10 - 1, "BRGEW")
Cells(xf10, 11) = mygrid.getcellvalue(xf10 - 1, "WBSTK")
Cells(xf10, 12) = mygrid.getcellvalue(xf10 - 1, "WADAT")
Cells(xf10, 13) = mygrid.getcellvalue(xf10 - 1, "LFDAT")
Cells(xf10, 14) = mygrid.getcellvalue(xf10 - 1, "WERKS")
Cells(xf10, 15) = mygrid.getcellvalue(xf10 - 1, "ORT01_WE")
Cells(xf10, 16) = mygrid.getcellvalue(xf10 - 1, "VRKME")
Cells(xf10, 17) = mygrid.getcellvalue(xf10 - 1, "S_VGBEL")
Cells(xf10, 18) = mygrid.getcellvalue(xf10 - 1, "S_CHARG")
Cells(xf10, 19) = mygrid.getcellvalue(xf10 - 1, "VSTEL")
Cells(xf10, 20) = mygrid.getcellvalue(xf10 - 1, "VKORG")
Cells(xf10, 21) = mygrid.getcellvalue(xf10 - 1, "KODAT")
'*******滚动第三列每一行---if-end********************
If xf10 Mod 80 And xf10 < mygrid.RowCount - 1 Then
mygrid.setCurrentCell xf10 + 1, "MATNR"
End If
'****************************************************
Next xf10
session.findById("wnd[0]").maximize
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
Else
On Error GoTo 0
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").maximize
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
End If
'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
'------------------------------------------------------------------------------------------------------------------------------------
xf00 = 0
session.findById("wnd[0]").maximize
session.findById("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell").doubleClickNode "F00003"
session.findById("wnd[0]/usr/btnBUTTON6").press
session.findById("wnd[0]").sendVKey 17
session.findById("wnd[1]/usr/txtV-LOW").Text = "311"
session.findById("wnd[1]/usr/txtENAME-LOW").Text = ""
session.findById("wnd[1]/usr/txtV-LOW").caretPosition = 3
session.findById("wnd[1]").sendVKey 8
session.findById("wnd[0]").sendVKey 8
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[1]/btn[18]").press
'&&&&&&&&&&&&&如果没有查询结果,则执行不同的条件语句&&&&&&&
On Error Resume Next
session.findById("wnd[0]/tbar[1]/btn[33]").press
xf00 = Err.Number
If xf00 = 0 Then
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").setCurrentCell 5, "TEXT"
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").firstVisibleRow = 0
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").selectedRows = "5"
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").doubleClickCurrentCell
Set mygrid = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell")
xf22 = mygrid.RowCount
For xf21 = 1 To xf22
Cells(xf21 + xf11, 1) = mygrid.getcellvalue(xf21 - 1, "VBELN")
Cells(xf21 + xf11, 2) = mygrid.getcellvalue(xf21 - 1, "LGORT")
Cells(xf21 + xf11, 3) = mygrid.getcellvalue(xf21 - 1, "NAME_WE")
Cells(xf21 + xf11, 4) = mygrid.getcellvalue(xf21 - 1, "ZZTEXT")
Cells(xf21 + xf11, 5) = mygrid.getcellvalue(xf21 - 1, "MATNR")
Cells(xf21 + xf11, 6) = mygrid.getcellvalue(xf21 - 1, "ARKTX")
Cells(xf21 + xf11, 7) = mygrid.getcellvalue(xf21 - 1, "S_MEINS")
Cells(xf21 + xf11, 😎 = mygrid.getcellvalue(xf21 - 1, "S_LGMNG")
Cells(xf21 + xf11, 9) = mygrid.getcellvalue(xf21 - 1, "VOLUM")
Cells(xf21 + xf11, 10) = mygrid.getcellvalue(xf21 - 1, "BRGEW")
Cells(xf21 + xf11, 11) = mygrid.getcellvalue(xf21 - 1, "WBSTK")
Cells(xf21 + xf11, 12) = mygrid.getcellvalue(xf21 - 1, "WADAT")
Cells(xf21 + xf11, 13) = mygrid.getcellvalue(xf21 - 1, "LFDAT")
Cells(xf21 + xf11, 14) = mygrid.getcellvalue(xf21 - 1, "WERKS")
Cells(xf21 + xf11, 15) = mygrid.getcellvalue(xf21 - 1, "ORT01_WE")
Cells(xf21 + xf11, 16) = mygrid.getcellvalue(xf21 - 1, "VRKME")
Cells(xf21 + xf11, 17) = mygrid.getcellvalue(xf21 - 1, "S_VGBEL")
Cells(xf21 + xf11, 18) = mygrid.getcellvalue(xf21 - 1, "S_CHARG")
Cells(xf21 + xf11, 19) = mygrid.getcellvalue(xf21 - 1, "VSTEL")
Cells(xf21 + xf11, 20) = mygrid.getcellvalue(xf21 - 1, "VKORG")
Cells(xf21 + xf11, 21) = mygrid.getcellvalue(xf21 - 1, "KODAT")
If xf21 Mod 80 And xf21 < mygrid.RowCount - 1 Then
mygrid.setCurrentCell xf21 + 1, "MATNR"
End If
Next xf21
session.findById("wnd[0]").maximize
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
Else
On Error GoTo 0
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").maximize
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
End If
'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
'---------------------------------------------------------------------------------------------------------------------
xf00 = 0
session.findById("wnd[0]").maximize
session.findById("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell").doubleClickNode "F00003"
session.findById("wnd[0]/usr/btnBUTTON6").press
session.findById("wnd[0]").sendVKey 17
session.findById("wnd[1]/usr/txtV-LOW").Text = "312"
session.findById("wnd[1]/usr/txtENAME-LOW").Text = ""
session.findById("wnd[1]/usr/txtV-LOW").caretPosition = 3
session.findById("wnd[1]").sendVKey 8
session.findById("wnd[0]").sendVKey 8
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[1]/btn[18]").press
'&&&&&&&&&&&&&如果没有查询结果,则执行不同的条件语句&&&&&&&
On Error Resume Next
session.findById("wnd[0]/tbar[1]/btn[33]").press
xf00 = Err.Number
If xf00 = 0 Then
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").setCurrentCell 5, "TEXT"
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").firstVisibleRow = 0
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").selectedRows = "5"
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").doubleClickCurrentCell
Set mygrid = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell")
xf32 = mygrid.RowCount
For xf31 = 1 To xf32
Cells(xf31 + xf21 + xf11, 1) = mygrid.getcellvalue(xf31 - 1, "VBELN")
Cells(xf31 + xf21 + xf11, 2) = mygrid.getcellvalue(xf31 - 1, "LGORT")
Cells(xf31 + xf21 + xf11, 3) = mygrid.getcellvalue(xf31 - 1, "NAME_WE")
Cells(xf31 + xf21 + xf11, 4) = mygrid.getcellvalue(xf31 - 1, "ZZTEXT")
Cells(xf31 + xf21 + xf11, 5) = mygrid.getcellvalue(xf31 - 1, "MATNR")
Cells(xf31 + xf21 + xf11, 6) = mygrid.getcellvalue(xf31 - 1, "ARKTX")
Cells(xf31 + xf21 + xf11, 7) = mygrid.getcellvalue(xf31 - 1, "S_MEINS")
Cells(xf31 + xf21 + xf11, 😎 = mygrid.getcellvalue(xf31 - 1, "S_LGMNG")
Cells(xf31 + xf21 + xf11, 9) = mygrid.getcellvalue(xf31 - 1, "VOLUM")
Cells(xf31 + xf21 + xf11, 10) = mygrid.getcellvalue(xf31 - 1, "BRGEW")
Cells(xf31 + xf21 + xf11, 11) = mygrid.getcellvalue(xf31 - 1, "WBSTK")
Cells(xf31 + xf21 + xf11, 12) = mygrid.getcellvalue(xf31 - 1, "WADAT")
Cells(xf31 + xf21 + xf11, 13) = mygrid.getcellvalue(xf31 - 1, "LFDAT")
Cells(xf31 + xf21 + xf11, 14) = mygrid.getcellvalue(xf31 - 1, "WERKS")
Cells(xf31 + xf21 + xf11, 15) = mygrid.getcellvalue(xf31 - 1, "ORT01_WE")
Cells(xf31 + xf21 + xf11, 16) = mygrid.getcellvalue(xf31 - 1, "VRKME")
Cells(xf31 + xf21 + xf11, 17) = mygrid.getcellvalue(xf31 - 1, "S_VGBEL")
Cells(xf31 + xf21 + xf11, 18) = mygrid.getcellvalue(xf31 - 1, "S_CHARG")
Cells(xf31 + xf21 + xf11, 19) = mygrid.getcellvalue(xf31 - 1, "VSTEL")
Cells(xf31 + xf21 + xf11, 20) = mygrid.getcellvalue(xf31 - 1, "VKORG")
Cells(xf31 + xf21 + xf11, 21) = mygrid.getcellvalue(xf31 - 1, "KODAT")
If xf31 Mod 80 And xf31 < mygrid.RowCount - 1 Then
mygrid.setCurrentCell xf31 + 1, "MATNR"
End If
Next xf31
session.findById("wnd[0]").maximize
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
Else
On Error GoTo 0
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").maximize
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
End If
'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
End Sub
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hui Wu,
I mentioned it before. The decisive factor is where occurs the error exactly. If the error does not appear until the next line in the case of missing data, the solution could look like this.
...
session.findById("wnd[0]/tbar[1]/btn[18]").press
'&&&&&&&&&&&&&如果没有查询结果,则执行不同的条件语句&&&&&&&
session.findById("wnd[0]/tbar[1]/btn[33]").press
On Error Resume Next
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").setCurrentCell 5, "TEXT"
If Err.Number = 0 Then
On Error GoTo 0
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").firstVisibleRow = 0
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").selectedRows = "5"
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").doubleClickCurrentCell
Set mygrid = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell")
xf11 = mygrid.RowCount
For xf10 = 1 To xf11
Cells(xf10, 1) = mygrid.getcellvalue(xf10 - 1, "VBELN")
Cells(xf10, 2) = mygrid.getcellvalue(xf10 - 1, "LGORT")
Cells(xf10, 3) = mygrid.getcellvalue(xf10 - 1, "NAME_WE")
Cells(xf10, 4) = mygrid.getcellvalue(xf10 - 1, "ZZTEXT")
Cells(xf10, 5) = mygrid.getcellvalue(xf10 - 1, "MATNR")
Cells(xf10, 6) = mygrid.getcellvalue(xf10 - 1, "ARKTX")
Cells(xf10, 7) = mygrid.getcellvalue(xf10 - 1, "S_MEINS")
'*******滚动第三列每一行---if-end********************
If xf10 Mod 80 And xf10 < mygrid.RowCount - 1 Then
mygrid.setCurrentCell xf10 + 1, "MATNR"
End If
'****************************************************
Next xf10
session.findById("wnd[0]").maximize
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
Else
On Error GoTo 0
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").maximize
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
End If
'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& end sub
Regards,
ScriptMan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Script Man thank you so much
I modified the code according to your answer,but It seems to have some problems,it can work at first time,but i try it again, it doesn't work.....
plsease help me again, thank you so muchSub xaa()
xf11 = 0
xf21 = 0
xf10 = 0
xf22 = 0
xf30 = 0
xf31 = 0
xf32 = 0
If Not IsObject(VBAPP) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set VBAPP = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(Connection) Then
Set Connection = VBAPP.Children(0)
End If
If Not IsObject(session) Then
Set session = Connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject VBAPP, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/usr/cntlIMAGE_CONTAINER/shellcont/shell/shellcont[0]/shell").doubleClickNode "F00003"
session.findById("wnd[0]/usr/btnBUTTON6").press
session.findById("wnd[0]").sendVKey 17
session.findById("wnd[1]/usr/txtV-LOW").Text = "311"
session.findById("wnd[1]/usr/txtENAME-LOW").Text = ""
session.findById("wnd[1]/usr/txtV-LOW").caretPosition = 3
session.findById("wnd[1]").sendVKey 8
session.findById("wnd[0]").sendVKey 8
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[1]/btn[18]").press
'&&&&&&&&&&&&&如果没有查询结果,则执行不同的条件语句&&&&&&&
On Error Resume Next
session.findById("wnd[0]/tbar[1]/btn[33]").press
If Err.Number = 0 Then
On Error GoTo 0
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").setCurrentCell 5, "TEXT"
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").firstVisibleRow = 0
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").selectedRows = "5"
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").doubleClickCurrentCell
Set mygrid = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell")
xf11 = mygrid.RowCount
For xf10 = 1 To xf11
Cells(xf10, 1) = mygrid.getcellvalue(xf10 - 1, "VBELN")
Cells(xf10, 2) = mygrid.getcellvalue(xf10 - 1, "LGORT")
Cells(xf10, 3) = mygrid.getcellvalue(xf10 - 1, "NAME_WE")
Cells(xf10, 4) = mygrid.getcellvalue(xf10 - 1, "ZZTEXT")
Cells(xf10, 5) = mygrid.getcellvalue(xf10 - 1, "MATNR")
Cells(xf10, 6) = mygrid.getcellvalue(xf10 - 1, "ARKTX")
Cells(xf10, 7) = mygrid.getcellvalue(xf10 - 1, "S_MEINS")
'*******滚动第三列每一行---if-end********************
If xf10 Mod 80 And xf10 < mygrid.RowCount - 1 Then
mygrid.setCurrentCell xf10 + 1, "MATNR"
End If
'****************************************************
Next xf10
session.findById("wnd[0]").maximize
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
Else
On Error GoTo 0
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").maximize
session.findById("wnd[0]").sendVKey 3
session.findById("wnd[0]").sendVKey 3
End If
'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hui Wu,
the example below assumes that the error occurred on the yellow-marked line.
...
on error resume next
session.findById("wnd[0]/tbar[1]/btn[33]").press
if err.number = 0 then
on error goto 0
session.findById("wnd[1]/usr/cntlGRID/shellcont/shell").setCurrentCell 5, "TEXT"
...
else
on error goto 0
msgbox "The desired button is not available."
end if
...
Regards, ScriptMan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Script Man thank you so much
before you answer ,I saw this answer you write before six years ago, here
https://archive.sap.com/discussions/message/11133390#11133390
i got my job done..
but I have another question is
if the query is no date ,the VBA is coming this problem
How can i continue to execute code of rest...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hui Wu,
you could try the following:
...
For xf10 = 1 To xf11
mygrid.currentCellRow = xf10 - 1
Cells(xf10, 1) = mygrid.getcellvalue(xf10 - 1, "VBELN")
...
Regards,
ScriptMan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.