There is a Macro that is triggered by a specific button press.

How can I get the current line in which the user is through VBA and process it in the module that calls the macro?

I do not use any forms, the user works directly in the tables.

I found the method Screen.ActiveDatasheet , but I don’t understand how to Screen.ActiveDatasheet field names from it and Screen.ActiveDatasheet over all the values ​​in the row.

  • Maybe you need a method CurrentRecord? - Sergey Tambovtsy
  • Yes, you are almost right. I used RecordSet and found the column there. - iluxa1810

1 answer 1

Made this decision:

  Function main(FieldName As String) Dim objDatasheet As Variant objDatasheet = Screen.ActiveDatasheet.Recordset.Fields(FieldName).Value If IsNull(objDatasheet) Then Exit Function End If On Error Resume Next Application.FollowHyperlink objDatasheet End Function