+ Reply to Thread
Results 1 to 6 of 6

Macro to open different file at different times

  1. #1
    Registered User
    Join Date
    09-22-2012
    Location
    colombo,srilanka
    MS-Off Ver
    Excel 2007
    Posts
    11

    Macro to open different file at different times

    I need to write a excel macro in that will open a excel files and run a macro on them. The name of those files will be changed in the next day. can somebody help me to develop a macro that will open a excel files that names of those while will be changed time to time?

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro to open different file at different times

    Hi, mfmalthaf,

    what is the common part of teh file name and how does the date relate to the variable part? Have you had a look at Application.GetOpenFilename:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    09-22-2012
    Location
    colombo,srilanka
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Macro to open different file at different times

    Thank you for the reply Ciao. There is no common part for the files name ( some times there can be but i cannot assure you always there will be a common part) and date is not related to the name too.
    I will look up the application you said Ciao.

    Im wondering whether i can enter the file name ( to be opened) in excel (in a specific cell ) and macro could open the entered file in the excel and run the macro on it

    Thnks.
    Althaf

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Macro to open different file at different times

    Hi, Althaf,

    of course you can use a cell for opening but you should specify drive, folder and name of the file there if the workbook is not located in the same directory as the workbook with teh code.

    Difference between Application.GetOpenFilename (delivers a string which may be handle in code later on) and Application.Dialogs(xlDialogOpen).Show (opens a file if chosen instantly) is on how you want to proceed further on.

    Please Login or Register  to view this content.
    where A1 should show something like E:\Book2.xls.

    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    09-22-2012
    Location
    colombo,srilanka
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Macro to open different file at different times

    Thnk you soo much Ciao, this really works...

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Macro to open different file at different times

    @ mfmalthaf

    Welcome to the forum.

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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