+ Reply to Thread
Results 1 to 6 of 6

Macro to Open Excel file, Update links, and Save

  1. #1
    Registered User
    Join Date
    05-30-2012
    Location
    NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    21

    Macro to Open Excel file, Update links, and Save

    Hi All!

    I'm trying to setup a macro that will update a few excel files then save them. I have the hyperlinks listed in an excel sheet like below so that the macro knows where to reference. Thanks!!

    Data Datapod File Name
    01/31/17 S:\doc1
    01/31/17 S:\doc2
    02/01/17 S:\doc3
    02/01/17 S:\doc4
    01/18/17 S:\doc5
    Last edited by harry1013; 03-01-2017 at 12:08 PM.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Macro to Open Excel file, Update links, and Save

    You could try Google:

    One link found
    http://www.excel-easy.com/vba/examples/close-open.html
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    05-30-2012
    Location
    NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Macro to Open Excel file, Update links, and Save

    Thanks but it still doesn't show me how to loop a code into running each file. It just states the basics of how it works.

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Macro to Open Excel file, Update links, and Save

    You use this code as the basic macro
    Around it you loop through each row and open the file you mention in the columns A then run the code to open update and close and do the next one.
    Try reading the code like you would a book, line by line if this then that else ....

    VBA is straight forward and logic thinking. It's good brain gymnastics and doing it yourself using found samples is the way to learn it we all did one way or another and practice, patience and perseverance are required.

    If you have a macro and are still very stuck attach it as a sample and we go on from there but at least give it a try, you did not mention that you do not know nothing of VBA

  5. #5
    Registered User
    Join Date
    05-30-2012
    Location
    NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Macro to Open Excel file, Update links, and Save

    Never mind, someone replied to my post from another excel forum that was very helpful. Below is the code I'm now using now. For future reference Keebellah, not everyone is as skilled at coding as you are. Googling these answers doesn't always provide the custom fit I'm looking for since I don't have the background and knowledge you do.

    Sub openfilessave()

    Application.ScreenUpdating = False
    For i = 22 To 34
    With Workbooks.Open(Range("B" & i))
    .Save
    .Saved = True
    .Close 0
    End With
    Next
    Application.ScreenUpdating = True

    End Sub

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Macro to Open Excel file, Update links, and Save

    And for your reference too, skill comes with practice and I am still learning every day.
    I'm not skilled I just try solving it and use logic.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 06-09-2016, 12:05 PM
  2. Macro to open, update links, save then close all files in sub folders
    By msdelaney in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-03-2015, 05:48 PM
  3. [SOLVED] Macro to open Excel file, run other macros save, and close file & repeat.
    By Ronnet2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-08-2015, 09:47 AM
  4. Code Problem(open excel file update links)
    By farrukh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-09-2011, 02:16 PM
  5. Replies: 2
    Last Post: 02-06-2007, 08:26 AM
  6. [SOLVED] Ghost Links which force Excel to update on File Open
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2005, 09:05 AM
  7. Open File + Update Links then Close File
    By ph8 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-14-2005, 08:55 PM

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