How to save a WorkBook to SharePoint?

R

ryguy7272

How to save a WorkBook to SharePoint?

I Dimmed a WorkBook as such:
Dim SaveWB As Workbook

Now, I’m trying to assign a String to the WB and save it, as such:
SaveWB = imgElement.Title
SaveWB.Save
Application.EnableEvents = False
SaveWB.CheckIn True, "Update", True
Application.EnableEvents = True

‘imgElement.Title’ comes from SharePoint
Set imgElements = HTMLdoc.getElementsByTagName("img")
For Each imgElement In imgElements

Next

I keep getting an error that says ‘object variable or with block not
set’. I don’t know what the ‘imgElement.Title’ will be beforehand so
I have to create it dynamically.

Any ideas on how to assign this String to a WB?

This snippet of code 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

Thanks!
Ryan---
 
J

Jim Cone

I don't have access to SharePoint and have never used it.
With that sterling recommendation in mind...

The SaveWB object has been declared but it has not been Set.
You need:
Set SaveWB = imgElement.Title
-Or-
More likely:
Set SaveWB = Workbooks(imgElement.Title)
--
Jim Cone
Portland, Oregon USA
http://www.mediafire.com/PrimitiveSoftware





"ryguy7272" <[email protected]>
wrote in message
How to save a WorkBook to SharePoint?

I Dimmed a WorkBook as such:
Dim SaveWB As Workbook

Now, I’m trying to assign a String to the WB and save it, as such:
SaveWB = imgElement.Title
SaveWB.Save
Application.EnableEvents = False
SaveWB.CheckIn True, "Update", True
Application.EnableEvents = True

‘imgElement.Title’ comes from SharePoint
Set imgElements = HTMLdoc.getElementsByTagName("img")
For Each imgElement In imgElements

Next

I keep getting an error that says ‘object variable or with block not
set’. I don’t know what the ‘imgElement.Title’ will be beforehand so
I have to create it dynamically.

Any ideas on how to assign this String to a WB?

This snippet of code 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

Thanks!
Ryan---
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top