title: Naming the PDF after exporting with Excel VBA
body: <p>I have a code which gets data from a sheet and populates a form. Within the data there are duplicate entries. [Refer to Data img.]</p>
  
  <pre><code>Dim i As Long
  Dim dataWS As Worksheet, formWS As Worksheet
  Dim thisFile As Range, destRange As Range
  Dim thisFile2 As Range, destRange2 As Range
  
  FolderPath = "C:\Users\Lenovo\Documents\PAF_Output\"
  
  MkDir FolderPath
  
  Set dataWS = Sheets("Data")
  Set formWS = Sheets("Form")
  For i = 2 To 5
  
  Set thisFile2 = dataWS.Range("A" &amp; i) 
  Set destRange2 = formWS.Range("B4:I4")
  thisFile2.Copy destRange2
  
  Set thisFile = dataWS.Range("B" &amp; i) 
  Set destRange = formWS.Range("O4:Q4")
  thisFile.Copy destRange
  
  Sheets(Array("Form")).Select
  ActiveSheet.ExportAsFixedFormat _
  Type:=xlTypePDF, FileName:=FolderPath &amp; thisFile2.Value &amp; ".pdf", _
  openafterpublish:=False, ignoreprintareas:=False
  
  
  Next i
  
  End Sub
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/IiT6N.jpg" rel="nofollow noreferrer">Data</a></p>
  
  <p>As you can see from </p>
  
  <pre><code>FileName:=FolderPath &amp; thisFile2.Value &amp; ".pdf"
  </code></pre>
  
  <p>The files are named after the values from column A. Nonetheless, in the case of the duplicate entries, excel will override the first file with the second one. What I'm trying to do is now create a name combining the names of the values within Column A and the arrival date values in Column B. Like this...</p>
  
  <pre><code>FileName:=FolderPath &amp; thisFile2.Value &amp; thisFile.Value &amp; ".pdf"
  </code></pre>
  
  <p>This throws me an error though. Can someone help me please?</p>