title: Copying Filename From Origin Excel Workbook Into Destination Excel Workbook
body: <p>Is there any way to copy the filename from an opened Excel workbook, and paste it into a destination workbook? I have a macro that copies the data from my open workbook, but I'm not sure how to grab the filename.</p>
  <p>This is the macro I have to copy the entire selection from my open workbook. How would I add the filename to this? Thank you!</p>
  <pre><code>Sub LazyBill()
  ' LazyBill Macro
  '
  ' Keyboard Shortcut: Ctrl+d
  '
  Dim SFC_Ver
  Dim WB1 As Workbook, WbName As String
  Dim WB2 As Workbook, Wb2Name As String
  'Dim Ksearch As Range
  Dim Kvalue As String
  Set WB1 = ActiveWorkbook
      WbName = ActiveWorkbook.Name
  'Open .cvs file to input
  'MsgBox (&quot;Once you click OK a File Open window will appear. Browse to the .cvs file that you wish to add to the trend data and click open&quot;)
      Filename = False
      Filename = Application.GetOpenFilename
          If Filename = False Then
              CloseMaster
          End If
          
  Dim sStarDir As String
  sStarDir = CurDir
      ChDir &quot;\\sw\data\****&quot;
  Application.DefaultFilePath = sStarDir
  
      Workbooks.Open Filename:= _
      Filename
              Set WB2 = ActiveWorkbook
                  Wb2Name = ActiveWorkbook.Name
      Cells.Select
      Selection.Copy
      Windows(WbName).Activate
      Sheets(&quot;DATA&quot;).Select
  'Paste data into trend data file
      Range(&quot;A1&quot;).Select
      ActiveSheet.Paste
      Application.CutCopyMode = 0
  'Close Trend data .cvs file
      Windows(Wb2Name).Activate
              ActiveWorkbook.Close False
  
  End Sub
  </code></pre>