Q:

build method command in cell and run it in vba

I have the following command which runs correctly if placed inside a macro in vba:
Set elements = doc.getElementsByClassName("media-body")

I try to have this command running while taking the information from within a cell. Thus I place 
doc.getElementsByClassName("media-body")

in cell D5 , but when I run:
Set elements = evaluate("Range(""D5"")") it throws an error (Run-time error '424': Object required.
Is there a way to solve it?

A:

No, there isn't a way to solve it.  Excel.Application.Evaluate only works with a subset of Excel objects.  From the documentation:

Remarks 
The following types of names in Microsoft Excel can be used
  with this method: 
Formulas. A1-style references. You can use any
  reference to a single cell in A1-style notation. All references are
  considered to be absolute references. 
Ranges. You can use the range,
  intersect, and union operators (colon, space, and comma, respectively)
  with references. Defined names. You can specify any name in the
  language of the macro. 
External references. You can use the ! operator
  to refer to a cell or to a name defined in another workbook ? for
  example, Evaluate("[BOOK1.XLS]Sheet1!A1"). 
Chart Objects. You can
  specify any chart object name, such as "Legend", "Plot Area", or
  "Series 1", to access the properties and methods of that object. For
  example, Charts("Chart1").Evaluate("Legend").Font.Name returns the
  name of the font used in the legend.

The reason that you get an error 424 is because doc is an object reference in the code you are trying to run from the cell.  Evaluate has no clue what doc is, because there is no way to set it to an instance from within a cell.  
The only way to do anything meaningful with the cell contents in the question would be to parse the code in the cell and basically run it through an VBA-VBA interpreter.  
EDIT
If I understand correctly what you're after (see the comments), what you'd really like is a way to generically search for HTML elements based on name and type.  I'd approach this by selecting how to search the element name based on a type parameter.  The example below assumes that the target cell (in row sourceRow and column sourceCol) contains the element name, ie "media-body", and the cell to the right contains its type - i.e. "ClassName".
Public Function GetElement(targetSheet As Worksheet, doc As HTMLDocument, _
                           sourceRow As Long, sourceCol As Long) As IHTMLElement
    With targetSheet
        'Get the element name from the passed cell.
        Dim elementName As String
        elementName = .Cells(sourceRow, sourceCol)
        'Get the element type from the adjacent cell.
        Dim elementType As String
        elementType = .Cells(sourceRow, sourceCol + 1)
        Select Case elementType
            Case "ClassName"
                Set GetElement = doc.getElementsByClassName(elementName)
            Case "Id"
                Set GetElement = doc.getElementById(elementName)
            Case "Name"
                Set GetElement = doc.getElementsByName(elementName)
            '...
        End Select
    End With
End Function

This could just as easily be accomplished with a comma delimited string in a single cell - something like "media-body,ClassName", or several other methods but this is the direction I'd go.

