Extracting the name of an Excel cell style in Dot Net code RRS feed

  • Question

  • Hello,

    In the past, I have used the following construct successfully:

    Imports Microsoft.Office.Interop.Excel

    Private Shared Sub M_S_HideColumnOrRowStrips(ByVal V_V_Scalar_Worksheet_Generic As Worksheet)

    Dim L_V_Scalar_Range_HomeCell As Range = V_V_Scalar_Worksheet_Generic.Range("A1")

    Dim L_V_Scalar_Range_StripCellCurrent As Range = L_V_Scalar_Range_HomeCell.Offset(0,0)

    Dim L_V_Scalar_Style_StripCellCurrent As Style = DirectCast(L_V_Scalar_Range_StripCellCurrent.Style, Style)

    Dim L_V_Scalar_String_StripCellCurrentStyle As String = L_V_Scalar_Style_StripCellCurrent.ToString

    End Sub

    However, when I run this, the value of L_V_Scalar_String_StripCellCurrentStyle is System.__COMObject, not the style associated with such cell. Has something changed with COM Interop over the recent versions of Excel, because I believe that this approach used to work for me?

    Many thanks.


    R K Howard

    Wednesday, October 31, 2018 8:28 PM