Delay Macro while workbook refreshes from sharepoint

Godders199

Active Member
Joined
Mar 2, 2017
Messages
313
Office Version
  1. 2013
Hello, I have the following macro to pull information from another workbook. When this work book opens it refreshes the data from a sharepoint list. I have tried various attempts to pause the macro to allow the refresh to happen. I have tried various code from the current Activeworkbook.Refreshall, to Applicationwait. but none seem to work. Is there a code i can use, that will open the workbook. wait for the refresh, and then filter? The workbook is current set to auto refresh.

I use Excel 2013
Code:
   Workbooks.Open Filename:= _
        "S:\4th Floor\SQ Operations\OPs Mi Spreadsheets\Allocation audit tools\Allocation Data\Sharepoint allocation list.xlsm"
        Dim sh1 As Worksheet
        Set sh1 = Worksheets("sheet1")
        With sh1.Range("a1").CurrentRegion
        ActiveWorkbook.RefreshAll
DoEvents
              
        .AutoFilter Field:=9, Field:=9, Criteria1 _
        :="=File & Call Listening", Operator:=xlOr, Criteria2:="=File & Outbound"
        End With
     Columns("a:l").Select
    Application.CutCopyMode = False
    Selection.Copy
   Windows("Allocation 2018.xlsm").Activate
Sheets("Material").Select
Range("a1").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
        Application.DisplayAlerts = False
        Range("a1").Select
Windows("sharepoint allocation list.xlsm").Activate
ActiveSheet.ShowAllData
ActiveWorkbook.Close
Some help would be appreciated.
 
Last edited by a moderator:

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Re: Delay Marco while workbook refreshes from sharepoint

If you set the properties for all the data connections in the workbook so that they do not refresh in the background, your code should work.
 
Upvote 0
Re: Delay Marco while workbook refreshes from sharepoint

Thanks for your reply, I have tried and the current code does not refresh the workbook.
 
Upvote 0
Re: Delay Marco while workbook refreshes from sharepoint

You mean it doesn't refresh at all?
 
Upvote 0
Re: Delay Marco while workbook refreshes from sharepoint

yes it does not refresh, i have checked there are new items on the sharepoint list and my current coding will not refresh at all.
 
Upvote 0

Forum statistics

Threads
1,223,276
Messages
6,171,139
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top