0

I need help. What is the correct way? Is the syntax correct?

If Not session.findById("wnd[0]/usr/tabsTABSPR1/tabpSP20/ssubTABFRA1:SAPLMGMM:2000/subSUB2:SAPLMGD1:2701/txtMARD-LGPBE").ActiveControl Then
  Cells(x, 5) = ""
End If

or

If Not session.findById("wnd[0]/usr/tabsTABSPR1/tabpSP20/ssubTABFRA1:SAPLMGMM:2000/subSUB2:SAPLMGD1:2701/txtMARD-LGPBE").SetFocus=true Then
  Cells(x, 5) = ""
End If

Thanks

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • It is very difficult to guess what you want to achieve. Could you improve the headline to something like "Should I use SetFocus or ActiveControl for ..." where ... is for what you want to achieve. Also, the text in the question is not very informative. Could you be more precise in describing what your problem is: The correct syntax? The right function to call for a certain task? Otherwise, it is difficult for others to help if they have to guess what the problem is. – mgd Aug 18 '14 at 16:18

1 Answers1

0

You might search for how to determine what the activecontrol is, then check to see if that matches the control of your concern. Try this:

Getting the activecontrol name and value from a multipages form

Another concern is that it looks like you're using an SAP Excel add-in. Is this code the result of recording the interaction with that control?

Community
  • 1
  • 1
n8.
  • 1,732
  • 3
  • 16
  • 38