ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to save a WorkBook to SharePoint? (https://www.excelbanter.com/excel-programming/443383-re-how-save-workbook-sharepoint.html)

ryguy7272[_2_]

How to save a WorkBook to SharePoint?
 
On Jul 21, 6:05*pm, "Jim Cone" wrote:
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 *USAhttp://www.mediafire.com/PrimitiveSoftware

"ryguy7272"
wrote in ...
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---



Thanks Jim!! I was playing with code similar to that, but a bit
different. Mine didn't work; yours didn't work either, but I think
it's close. Here's the scenario,
imgElement.Title is a big ole' string with lots of stuff in it. What
I need is something like this: 'EXTPOS-0010071G71G25184.xls'; the
left 27 characters comprise the file name.

I'm now thinking that it is something like this:

MsgBox "Saving Changes and Checking your file into SharePoint now!!"
Set SaveWB = Workbooks(Left(UCase(imgElement.Title), 27))
SaveWB.Save
Application.EnableEvents = False
SaveWB.CheckIn True, "Update", True
Application.EnableEvents = True


However, that's NOT working...

I'm getting a Run-time Error 9
Subscript out of range

Errors on this line:
Set SaveWB = Workbooks(Left(UCase(imgElement.Title), 27))


So, I changed the code a bit; tried this:

NewWB = Left(UCase(imgElement.Title), 27)
Set SaveWB = Workbooks(NewWB)
SaveWB.Save
Application.EnableEvents = False
SaveWB.CheckIn True, "Update", True
Application.EnableEvents = True

Still getting the same error!!!



All times are GMT +1. The time now is 05:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com