In the two subroutines at the bottom of this post I am able to save a .gif from a workbook to a normal network folder but when I attempt to save to a SharePoint folder the code error out.
These two lines of code...
are from the code blocks below the first one works but when I try the second one (a SharePoint) folder the line
throws the error below.
Can anyone tell me what I'm doing wrong? I know very little about SharePoint only that the Company wants us to start migrating to it.
"ERROR MESSAGE"
Run-time error -2146697210 (800c0006):
Method Export of object _Chart failed
These two lines of code...
Code:
Save_Object_As_Picture Worksheets("CA Info").Range("C3:I142"), "\\Share01\sp\CSM_Systems_Admin\Frame35.gif"
Save_Object_As_Picture Worksheets("CA Info").Range("C3:I142"), "http://ssvc30-ap0238/ASeCSRR/F35/Workbooks/Frame35.gif"
Code:
.Chart.Export imageFileName
Can anyone tell me what I'm doing wrong? I know very little about SharePoint only that the Company wants us to start migrating to it.
"ERROR MESSAGE"
Run-time error -2146697210 (800c0006):
Method Export of object _Chart failed
Code:
Sub SaveImageToSharePoint()
Dim sWrkBkName As String
sWrkBkName = Left(Application.ActiveWorkbook.Name, Len(Application.ActiveWorkbook.Name) - 5)
'Save_Object_As_Picture Worksheets("CA Info").Range("C3:I142"), "\\Share01\sp\CSM_Systems_Admin\Frame35.gif"
Save_Object_As_Picture Worksheets("CA Info").Range("C3:I142"), "http://ssvc30-ap0238/ASeCSRR/F35/Workbooks/Frame35.gif"
MsgBox "Image has been submitted. Done."
End Sub
Public Sub Save_Object_As_Picture(saveObject As Object, imageFileName As String)
Dim temporaryChart As ChartObject
Application.ScreenUpdating = False
saveObject.CopyPicture xlScreen, xlPicture
Set temporaryChart = ActiveSheet.ChartObjects.Add(0, 0, saveObject.Width + 6, saveObject.Height + 6)
With temporaryChart
.Border.LineStyle = xlLineStyleNone 'No border
.Chart.Paste
.Chart.Export imageFileName
.Delete
End With
Application.ScreenUpdating = True
Set temporaryChart = Nothing
End Sub