Hadi Ul Bashar

About author

I'm Hadi Ul Bashar, an Engineering aspirant. I always look forward to keeping myself up to date in my area of interest. Currently, I'm happy to work at Exceldemy as an Excel & VBA Content Developer. My goal here is to provide an easy and detailed solution to whatever problem you may face in Excel. I hope I will make your Excel life easy as I'm always open to solve new problem!

Latest Posts From Hadi Ul Bashar

How to Use LARGE and SMALL Function in Excel (3 Examples)

If you want to find the 3rd most expensive smartphone from a list of smartphones, or you’re searching to solve a problem like this, you’re on the right page. ...

How to Create a Radial Bar Chart in Excel (with Easy Steps)

Suppose you are a product manager and want to compare the sale returns of your product in various outlets. Excel provides you with an option to do it in a ...

How to Prepare IF Statement Contains Multiple Words in Excel

In our day-to-day life, we have to make some decisions based on ‘IF’ and ‘Then’. For this task, Excel has a cool feature named IF for this purpose and we can ...

Browsing All Comments By: Hadi Ul Bashar
  1. Hello VIKASHINI,

    Thank you for explaining your issue in a concise way. Yes, it is possible to extract the whole sentence. You can apply the following steps for that:

    1. First of all, open your Word document.
    2. Go to Developer tab and select Visual Basic.
    3. Navigate to Insert tab and select Module.
    4. Type the following code in the module and press the F5 key to run the macro.

    Sub ExtractCommentsAndSentencesToExcel()
        Dim xApp As Excel.Application
        Set xApp = CreateObject("Excel.Application")
        xApp.Visible = True
        Dim xWB As Excel.Workbook
        Set xWB = xApp.Workbooks.Add
        Dim xWS As Excel.Worksheet
        Set xWS = xWB.Worksheets(1)
        xWS.Range("A1:B1").Value = Array("Sentence", "Comment")
        Dim rowNum As Integer
        rowNum = 2
        Dim doc As Document
        Set doc = ActiveDocument
        Dim cmnt As comment
        For Each cmnt In doc.Comments
            Dim sentenceText As String
            sentenceText = cmnt.Scope.Sentences(1).text
            xWS.Cells(rowNum, 1).Value = sentenceText
            xWS.Cells(rowNum, 2).Value = cmnt.Range.text
            rowNum = rowNum + 1
        Next cmnt
        Set xWS = Nothing
        Set xWB = Nothing
        Set xApp = Nothing
    End Sub

    Check the following images that contain the sample output.

    This is the output you will get in an Excel file.

    Please let me know if you have any further issues.
    Have a good day!

  2. Hello DEEP!

    From your comment, I think the most possible reason of the error could be inappropriate cell referencing. Please note that these formulas include both absolute and relative cell reference. You may copy paste the formulas, and then adjust the cell references according to your dataset. Hopefully that will solve your issue.

    solution of comment



    If you need further assistance regarding this, please feel free to send the Excel file in this email [email protected].

    Hadi Ul Bashar

Advanced Excel Exercises with Solutions PDF