Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simple Line of Code (Excel VBA)

    I want to paste the file name of an active file into a cell of another file.

    Thanks

  2. #2
    Lounger
    Join Date
    Jan 2004
    Location
    Prague, Czech Republic
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Simple Line of Code (Excel VBA)

    Hello,
    try:
    <pre>Sub PasteName()
    Dim trgSht As Excel.Worksheet
    srcWbkName = ActiveWorkbook.Name
    Set trgSht = Workbooks("Frequency.xls").Sheets(1)
    trgSht.[a1] = srcWbkName
    End Sub</pre>



    My workbook to write to is named Frequency.xls

    HTH

    Martin
    Regards,
    Martin

  3. #3
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Simple Line of Code (Excel VBA)

    Thanks

    ActiveWorkbook.Name

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •