I have VBA code that creates a JPG file on SharePoint of a chart of data. However, because versioning is turned on in SharePoint this chart is not visible to anyone else.
I can go into SharePoint and manually checkin all the JPG files I create -- but how do I do this through VBA after I create the files?
Here is the code snip that exports the chart - shown below. As mentioned above, this works fine - puts the file on SharePoint, but as CHECKED OUT. I want to check it in.
Thanks
=========================
Public Declare Function WNetGetConnection Lib "mpr.dll" _
Alias "WNetGetConnectionA" _
(ByVal lpszLocalName As String, _
ByVal lpszRemoteName As String, _
cbRemoteName As Long) As Long
Private Declare Function PathIsUNC Lib "shlwapi" _
Alias "PathIsUNCA" _
(ByVal pszPath As String) As Long
Public Sub ExportChart(sChartPath As String, ChartName As String)
Dim strUNC As String, sLocalChartPath As String
strUNC = FileUNC(sChartPath)
On Error Resume Next
Kill strUNC
On Error GoTo ERROR_Out
ActiveChart.Export FileName:=sChartPath, FilterName:="PNG"
Exit Sub
ERROR_Out:
Call SendEmailOut("chris.p.denardis@jci.com", "chris.p.denardis@jci.com", Worksheets("FrontEnd").Cells(9, 3).Value, " Error Posting PNG Files " & strUNC)
Resume Next
End Sub
Function FileUNC(ByVal strPath As String) As String
Dim strNetPath As String
strNetPath = String(255, Chr(0))
WNetGetConnection Left(strPath, 2), strNetPath, 255
If PathIsUNC(strNetPath) Then
FileUNC = Left(strNetPath, InStr(1, strNetPath, Chr(0)) - 1) & _
Right(strPath, Len(strPath) - 2)
Else
FileUNC = strPath
End If
End Function
Bookmarks