+ Reply to Thread
Results 1 to 2 of 2

get imported file name/date

Hybrid View

eminthepooh get imported file name/date 07-28-2009, 06:06 PM
Leith Ross Re: get imported file... 07-28-2009, 06:38 PM
  1. #1
    Registered User
    Join Date
    06-13-2009
    Location
    glendale, CA, America
    MS-Off Ver
    Excel 2003
    Posts
    10

    Question get imported file name/date

    I need to print the name of the file that I open into excel and the date it was created (or opened) onto cells H5 and I5
    so far, opening the file is this...
    sub open()
    sFileName = Application.GetOpenFilename
    
        If sFileName = False Then
            Exit Sub
        End If
        
        MyWorkBook = ActiveWorkbook.name
        'Clear the sheet
        ActiveSheet.Cells.Clear
        'open the specified file
        Workbooks.Open (sFileName)
        'set a variable to the file name (gets name of file without path)
        CBook = ActiveWorkbook.name
        'copy the data range
        Range("A:D").Copy
        'go back to the original workbook
        Windows(MyWorkBook).Activate
        'code to select the proper cell to paste to
        Cells(1, 1).Select
        ActiveSheet.Paste
    
    end sub
    any ideas?
    Last edited by eminthepooh; 07-28-2009 at 09:46 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: get imported file name/date

    Hello eminthepooh,

    Please wrap your code.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing.


    How to wrap your Code
    1. Select all your code using the mouse.
    2. Click on the # icon on the toolbar in the Message window. This will automatically wrap the text you selected with the proper Code tags to create a Code Window in your post.

    3. You can also do this manually by placing the tags
    [code] at the start of the line,
    [/code] at the end of the line.

    For more information about these and other tags, found here
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1