title: Replace invalid characters when saving excel as PDF
body: <p>sorry for the inconvenience. I've tried to google (I always said "google is my friend"), but everything I try only give me an error in VBA.</p>
  
  <p>I would like to add a function, which replace invalid characters (!"#¤%&amp;/()=?`^*>;:@£${[]}|~\,.'¨´+-) in filename with "_".</p>
  
  <p>This is my current (and working) macro:</p>
  
  <pre><code>Sub Save_to_PDF()
      Dim v As Variant
      Dim name, datedd As String
  
      ThisWorkbook.Sheets(Array("sheet1")).Select
  
      datedd = Date
      strFilename = Worksheets("sheet1").Range("B2")
      v = Application.GetSaveAsFilename(strFilename &amp; " document " &amp; datedd &amp; " .pdf", "PDF Files (*.pdf), *.pdf")
  
      On Error GoTo openfile
  
      If FileExists(v) Then
          Kill v
      End If
  
      If VarType(v) = vbString Then
          ThisWorkbook.Sheets("sheet1").Activate
          ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:=v, _
            Quality:=xlQualityStandard, IncludeDocProperties:=True, _
            IgnorePrintAreas:=False, From:=1, To:=1, OpenAfterPublish:=True
      End If
      Exit Sub
  
  openfile:
      MsgBox "You have one file open allready whith that name. Please try again", vbInformation, "Please close file"
      Exit Sub
  End sub
  </code></pre>