Posts by Leif Larsen

    Re: Open CSV Files By Date


    I added your suggestion after the MSGBOX, but I get the message: Runtime error '1004' and that the file could not be found.
    This is after the file does show in the MSGBOX.
    I get the same even when I delete the msgbox.


    Any clues?


    Thanks,


    Leif

    Re: Open CSV Files By Date


    Thanks, It works perfect.
    Now I am going to open the selected file so I can copy the content to a worksheet of the file that contain the macro. I have tried the following:


    I took out the Msgbox and added this:

    Code
    Workbooks.OpenText Filename:=" & sNewest"
    Cells.Select


    but I am obviously missing something. I am almost there!


    Thanks for your help,


    Leif[hr]*[/hr]

    Re: Open CSV Files By Date


    You are right - I missed the point of the Macro being in the same folder as the .CSV files. However after I changed it, now it picks the first rather than the last dated file. This probably only requires a small change- but how?
    Thanks for your help!
    Leif

    Re: Open CSV Files By Date


    I have tested the code suggested and it does not find the latest file. The message box comes up with: Most recent updated file =


    Any suggestions?


    Thanks,
    Leif

    Re: Eliminating The Save Command In A Macro


    It still does not work. Remember we are dealing not with an .xls file but an .iif file format which behaves differently. The file that contains the Macro is an .xls file but that is not the one I am trying to save.
    Any other clues?
    Thanks,
    Leif

    Re: Eliminating The Save Command In A Macro


    Thanks for your suggestion. I have tested it and find that I still get the same message: Do you want to save your changes?
    Any other ideas? Not sure why iif File format works different.
    Leif

    When I record a macro to open another file (iifFile) and make a change in it and close it and return to the original file, I reply to the message to save the change, but when I replay the macro the save window still comes up. I want to eliminate this manual action. How? In a regular Excel file it works OK.
    Thanks,
    Leif

    Re: Open CSV Files By Date


    Thanks for your help. I am wondering if the solution could be made simpler from the fact that I have discovered that the file that I want to identify and open is always the last file in the list in that folder.


    Thanks,
    Leif

    Re: Macro That Selects File By Last Date


    This is a typical file name: 9M5_PR_10122007_1192229896547 where the middle number is the date. The file is an excel .CSV. The same date is shown under "Date Modified".
    Hope this helps.
    Leif

    I have a folder with several downloaded payroll files. I want to write a macro in my "excel payroll converter" file which will selects and opens the last file downloaded. (So I can copy and paste it into my payroll converter.)
    Any suggestions are appreciated.
    Leif

    Re: Delete Range Between Last Used Row Across 2 Columns


    Thanks - Now it works after I replaced the last line with the new one.
    I have tried to modify the code by looking at Column D instead if Column C and I changed the 3 to a 4 in the following section of the code, however now I get the error:"type missmatch". Not sure why and how to correct?:


    Code
    lSLRow = Columns(4).Find(What:="*", After:=[C1], _
            SearchOrder:=xlByRows, _
            SearchDirection:=xlPrevious).Row


    Leif