VBA upload to sharepoint stuck in loop

rsutton1981

New Member
Joined
Mar 9, 2016
Messages
47
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am managed to get PDF export of sheets from excel to go to sharepoint. But when i run the code below it seems to loop back and start the process again, whilst not creating new files in the sharepoint folder it is updating the revision in the metadata. it creates all the files but never gets to the MsgBox stage.

Any help would be appreciated.

VBA Code:
Sub Button6_Click()

Application.ScreenUpdating = False
Dim ws As Worksheet
Dim ShCount As Integer, i As Integer, j As Integer
ShCount = Sheets.Count

For i = 4 To ShCount

For j = i + 1 To ShCount 

Sheets(j).Select
nm = Sheets(j).Name
 
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:= _
"https://hartiganengineers.sharepoint.com/sites/QMSupload/shared%20documents/" & nm & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
 
Next j
Next i

Application.ScreenUpdating = True
MsgBox "Export Complete"

End Sub
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,215,308
Messages
6,124,173
Members
449,146
Latest member
el_gazar

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