'This Code extracts a data range Into a word document but doesn't stop doing so at the right time. How do I use a range var for a dynamic range?

I would like this script to only output the correct number of rows to the document. Also, I would like it to generate a PDF instead of a Word Document, but I am unable to make this change. This line has errors when incorporating a dynamic range:

'Dim rows As Integer
'Sheets("Terminal Unit Output").Range("M1").Value2 = rows
Sheets("Terminal Unit Output").Range("A1:O" & rows).CopyPicture Appearance:=xlScreen, Format:=xlPicture

I don't know how to stop the excess Word Document outputs here: Excess Word Document outputs there's a bunch of blank items at the bottom of my dropdown list I don't know how to remove. To reset the sheet back to the first item at the end of the loop (AHU-1) I've tried:

Set dvCell = inputRange(1)

editable xlsm

Option Explicit
Sub GenerateReports()

    Dim objWord As Object
    Dim objDoc As Object
    Dim dvCell As Range
    Dim inputRange As Range
    Dim c As Range
    Dim i As Long
   
    ActiveWindow.View = xlNormalView
    
    Set dvCell = Sheets("General_Input").Range("B16")
    
    Set inputRange = Evaluate(dvCell.Validation.Formula1)
    
    Set objWord = CreateObject("Word.Application")
    
    objWord.Visible = True
    
    Set objDoc = objWord.Documents.Add
    
    For Each c In inputRange
        dvCell.Value = c.Value
        Sheets("Terminal Unit Output").Range("A1:O75").CopyPicture Appearance:=xlScreen, Format:=xlPicture
        objWord.Selection.Paste
        objWord.Selection.TypeParagraph
    Next c
    
    Set objWord = Nothing
    Set objDoc = Nothing
    Set dvCell = Nothing
    Set inputRange = Nothing

End Sub


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source