User Posts: Hadi Ul Bashar
0
Excel VBA to Concatenate Cell Values 
0

While working on Excel, sometimes we need to concatenate cell values. We can use Excel VBA to concatenate cell values easily. For example, if we have a dataset ...

0
Excel VBA Target Cell: 9 Practical Examples
0

Looking for ways to interact with a target cell using VBA in Excel? Then, this is the right place for you. If you want to interact with a cell in the ...

0
Excel VBA to Find Cell Address Based on Value (3 Examples)
0

If you frequently use Excel, you may have encountered scenarios where you needed the address of a cell that contained a specific value. For instance, we may ...

0
Excel VBA: Create InputBox with Multiple Inputs
0

Looking for ways to create an inputbox with multiple inputs using VBA in Excel? Then, this is the right place for you. Excel VBA InputBox is a built-in ...

0
Excel VBA Multidimensional Arrays 
0

If you’re thinking about storing multiple data against a common entry, a multidimensional array can serve the need. Multidimensional Arrays are arrays with ...

1
Excel MIN Function Returns 0: 2 Possible Scenarios
1

You may use Excel’s MIN function to get the minimum value from a range of cells. In some cases your Excel MIN function returns 0. In this article, I’m going to ...

0
Excel Data Validation for Date Format (4 Suitable Examples)
0

We use Excel in our day to day life. One important aspect while using Excel is that we need to use date and time every now and then. And you may have some ...

0
DMAX Method for Lactate Threshold in Excel
0

If you’re a fitness enthusiast or an expert, the possibility is that you may have heard about the Lactate threshold. The lactate threshold is an indicator of ...

0
How to Calculate Alpha in Excel (4 Suitable Examples)
0

If you’re ever interested in calculating the highest possible return from a minimum amount of investment risk, you’re in the right place. In this article, I’ll ...

0
Calculate Percentile from Mean and Standard Deviation in Excel
0

If you’re working on statistical data, you may require to calculate Percentile every now and then. There are several ways of calculating Percentiles. In this ...

0
How to Create Cost of Delay Calculator in Excel (with Easy Steps)
0

Business analysts frequently have to choose which goods or projects to prioritize. There is a trade-off between projects, particularly about which project one ...

0
How to Hide Filter Buttons in Excel
0

We often use Excel to maintain databases in our day-to-day life. In some cases, we need to filter our data based on specific conditions. This can be done ...

0
How to Use Excel VBA VLookup Within Loop
0

Have you ever spent hours manually matching data across multiple sheets or tables in Excel? The tedious and time-consuming task can leave you feeling ...

0
How to Create Pie Radar Chart in Excel
0

If you want to compare a set of data, Excel provides you with an option to compare in a smart way. Pie Radar Chart in Excel helps you to visualize your data ...

0
How to Ignore Blank Cells in Named Range in Excel
1

You may have seen many Excel Sheets with blank cells. Some of these blank cells may even exist under a Named Range. Excel in general doesn’t do anything on its ...

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
        
        xWS.Columns("A:B").AutoFit
        
        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!
    Regards,
    Bashar
    Exceldemy.

  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

    Output:

    output

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

    Regards
    Hadi Ul Bashar

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo