R
ryguy7272
I find a value for SaveFile as such:
SaveFile = Left(imgElement.Title, 27)
Then I get the path where this file needs to be saved, as such:
sPath = ThisWorkbook.Path & "/" & SaveFile
Then, I’m trying to check the file into SharePoint, which is something
like this:
Application.EnableEvents = False
wb.CheckIn True, "Update", True
Application.EnableEvents = True
…but it’s not working. Code fails on this line:
wb.CheckIn True, "Update", True
Error mssg is: ‘Run-time error 91. Object variable or With block
variable not set’
I have some sample code that works fine for opening a Template and
saving a (new) file to SharePoint (using a different technique):
sPath = strpath & "/" & striName & ".xls"
Dim sPathTemp As String
Set xlApp = New Excel.Application
xlApp.Visible = True
sPathTemp = strpath & "/" & "Template.xls"
Set wb = xlApp.Workbooks.Open(sPathTemp, , False)
xlApp.Workbooks("Template.xls").Worksheets("Sheet1").Range("D3") =
striName
xlApp.Workbooks.Application.CalculateFull
buildsavedest = ActiveWorkbook.Path & "/" & striName & ".xls"
xlApp.Workbooks("Template.xls").SaveAs buildsavedest
I also have code that checks a file into SharePoint; this works just
fine:
If ThisWorkbook.CanCheckIn = True Then
MsgBox "Saving Changes and Checking your File into SharePoint
now!!"
ThisWorkbook.Save
Application.EnableEvents = False
ThisWorkbook.CheckIn True, "Update", True
Application.EnableEvents = True
End If
All I need to do is save changes in an Excel file and check that file
into SharePoint:
File will be saved here:
sPath = ThisWorkbook.Path & "/" & SaveFile
There must be some problem just before the code below, or in the code
below, that is not setting the (Worksheet) object:
Application.EnableEvents = False
wb.CheckIn True, "Update", True
Application.EnableEvents = True
Any ideas?
Thanks for the help!!
Ryan--
SaveFile = Left(imgElement.Title, 27)
Then I get the path where this file needs to be saved, as such:
sPath = ThisWorkbook.Path & "/" & SaveFile
Then, I’m trying to check the file into SharePoint, which is something
like this:
Application.EnableEvents = False
wb.CheckIn True, "Update", True
Application.EnableEvents = True
…but it’s not working. Code fails on this line:
wb.CheckIn True, "Update", True
Error mssg is: ‘Run-time error 91. Object variable or With block
variable not set’
I have some sample code that works fine for opening a Template and
saving a (new) file to SharePoint (using a different technique):
sPath = strpath & "/" & striName & ".xls"
Dim sPathTemp As String
Set xlApp = New Excel.Application
xlApp.Visible = True
sPathTemp = strpath & "/" & "Template.xls"
Set wb = xlApp.Workbooks.Open(sPathTemp, , False)
xlApp.Workbooks("Template.xls").Worksheets("Sheet1").Range("D3") =
striName
xlApp.Workbooks.Application.CalculateFull
buildsavedest = ActiveWorkbook.Path & "/" & striName & ".xls"
xlApp.Workbooks("Template.xls").SaveAs buildsavedest
I also have code that checks a file into SharePoint; this works just
fine:
If ThisWorkbook.CanCheckIn = True Then
MsgBox "Saving Changes and Checking your File into SharePoint
now!!"
ThisWorkbook.Save
Application.EnableEvents = False
ThisWorkbook.CheckIn True, "Update", True
Application.EnableEvents = True
End If
All I need to do is save changes in an Excel file and check that file
into SharePoint:
File will be saved here:
sPath = ThisWorkbook.Path & "/" & SaveFile
There must be some problem just before the code below, or in the code
below, that is not setting the (Worksheet) object:
Application.EnableEvents = False
wb.CheckIn True, "Update", True
Application.EnableEvents = True
Any ideas?
Thanks for the help!!
Ryan--