+ Reply to Thread
Results 1 to 6 of 6

Macro to open & close mutiple xlsx files in folder

  1. #1
    Registered User
    Join Date
    11-03-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    29

    Macro to open & close mutiple xlsx files in folder

    Hi, I have some files in the shared folders which I need to open quite regularly to update (i.e. apply another macro to these files). I would need help with a macro that can open all the .xlsx files in a shared folder (no need to update link) and then another macro to save/close all these files when I'm done?

    Thanks a lot.

    Bernard

  2. #2
    Registered User
    Join Date
    11-03-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Macro to open & close mutiple xlsx files in folder

    Hi, can anyone please help? Thks.

  3. #3
    Registered User
    Join Date
    11-03-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Macro to open & close mutiple xlsx files in folder

    Please see codes below Whenever I tried to open the files, there will a prompt asking me to update links. Anyone can help to amend the codes below so that I do not have to press continue for each file please?

    Also, if possible, how about a code to close all these files?


    Dim sPath As String, sName As String
    Dim bk As Workbook
    sPath = "\\fs02\FIN\FinCom\bfr\FY12 Submissions\Corp Comm Grp\"
    sName = Dir(sPath & "*.xlsx")
    Do While sName <> ""
    Set bk = Workbooks.Open(sPath & sName)



    sName = Dir
    Loop

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Macro to open & close mutiple xlsx files in folder

    Please use code tags as per the forum rules.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  5. #5
    Registered User
    Join Date
    11-03-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Macro to open & close mutiple xlsx files in folder

    Hi Dom, please see the codes below in code tabs.


    Please Login or Register  to view this content.

  6. #6
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Macro to open & close mutiple xlsx files in folder

    Try:

    Please Login or Register  to view this content.
    Dom

+ 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