+ Reply to Thread
Results 1 to 8 of 8

How to use a macro to open files from sharepoint?

  1. #1
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    896

    How to use a macro to open files from sharepoint?

    Hi all,

    Hope all are well.

    I am using below macro to open excel file from an online sharepoint link and its working successfully.

    Please Login or Register  to view this content.
    However, there are 9 more files to be opened and therefore i modified the line as below to open 2 files at once.

    Please Login or Register  to view this content.
    But now the code doesn't work. Can someone please help how to add code for multiple files? Thanks in advance.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,839

    Re: How to use a macro to open files from sharepoint?

    You can't do that. Just repeat the Workbooks.Open line and change the file name each time. You could also put the filenames into an array and loop through that.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    896

    Re: How to use a macro to open files from sharepoint?

    Perfect. Repeating the Workbooks.Open code.

    Thanks a bunch

  4. #4
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,438

    Re: How to use a macro to open files from sharepoint?

    Instead of writing a long path in each file, consider using the following macro:
    Please Login or Register  to view this content.
    Artik

  5. #5
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    896

    Re: How to use a macro to open files from sharepoint?

    @Artik.

    That's great. Thanks a lot

  6. #6
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    896

    Re: How to use a macro to open files from sharepoint?

    Hi Artik,

    Hope you are well.

    Sorry but can you just help with 1 additional step.

    After all files are opened, I want the code to take me back to sheet "Main Page" in the original file from where macro was run.

    Could you please add this line at the end? Many thanks in advance.

  7. #7
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,438

    Re: How to use a macro to open files from sharepoint?

    Is it enough to add
    Please Login or Register  to view this content.
    ?

    Artik

  8. #8
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    896

    Re: How to use a macro to open files from sharepoint?

    Its working perfectly. Thanks a bunch for your lightning response

+ 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. Open files from sharepoint location sequentially and run macro before moving on
    By mpaxton78 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-19-2021, 09:34 AM
  2. [SOLVED] How do I only open folders and not specific files on macro using sharepoint
    By tweacle in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-03-2020, 03:17 PM
  3. [SOLVED] Open excel and PDF files from sharepoint
    By shreeja178 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-06-2016, 02:15 AM
  4. Can't find and open files on a Sharepoint drive
    By p24leclerc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-28-2015, 10:09 PM
  5. Open multiple excel files on sharepoint using VBA
    By BjarneP in forum Excel General
    Replies: 1
    Last Post: 02-03-2014, 04:44 PM
  6. [SOLVED] Open all files in a SharePoint folder (Problem: Files open out of order)
    By holmstarrunner in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-10-2012, 10:13 AM
  7. VBA code to open excel files in sharepoint
    By Ish23 in forum Excel General
    Replies: 1
    Last Post: 03-23-2011, 10:21 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