Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default How to save a WorkBook to SharePoint?


I am not going to be able to be any further help (hindrance) to you.
There are too many things I don't know about SharePoint.
For instance, is the Excel app on your computer even aware of workbooks on the server?
If not your current efforts with the string name are not going to help you.
A quick web search, "workbooks in sharepoint", turned up several possible useful links - if you speak the programming
language involved. (I don't)
--
Jim Cone
Portland, Oregon USA



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



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!!!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default How to save a WorkBook to SharePoint?

On Jul 21, 7:16*pm, "Jim Cone" wrote:
I am not going to be able to be any further help (hindrance) to you.
There are too many things I don't know about SharePoint.
For instance, is the Excel app on your computer even aware of workbooks on the server?
If not your current efforts with the string name are not going to help you.
A quick web search, "workbooks in sharepoint", turned up several possible useful links - if you speak the programming
language involved. (I don't)
--
Jim Cone
Portland, Oregon *USA

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


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!!!



-----------------------------------------------------------------------------------------------------------------
Here's my code now:

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

I'm using this: Left(UCase(imgElement.Title), 27)

To capture the name of the fiel that I want to save to SharePoint.
When I F8 through the code and mouse-over 'SaveThis', I can see that
the variable has the correct value...Excel just refuses to save the
file to SharePoint.

Even if I do this...

Set SaveWB = ThisWorkbook
Set SaveWB = Workbooks("SaveThis.xls")

just to test it...it still doesn't work...

Any ideas on this?

Thanks everyone!!
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default How to save a WorkBook to SharePoint?

On Jul 22, 9:23*am, ryguy7272 wrote:
On Jul 21, 7:16*pm, "Jim Cone" wrote:





I am not going to be able to be any further help (hindrance) to you.
There are too many things I don't know about SharePoint.
For instance, is the Excel app on your computer even aware of workbooks on the server?
If not your current efforts with the string name are not going to help you.
A quick web search, "workbooks in sharepoint", turned up several possible useful links - if you speak the programming
language involved. (I don't)
--
Jim Cone
Portland, Oregon *USA


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


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!!!


---------------------------------------------------------------------------*--------------------------------------
Here's my code now:

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

I'm using this: *Left(UCase(imgElement.Title), 27)

To capture the name of the fiel that I want to save to SharePoint.
When I F8 through the code and mouse-over 'SaveThis', I can see that
the variable has the correct value...Excel just refuses to save the
file to SharePoint.

Even if I do this...

Set SaveWB = ThisWorkbook
Set SaveWB = Workbooks("SaveThis.xls")

just to test it...it still doesn't work...

Any ideas on this?

Thanks everyone!!- Hide quoted text -

- Show quoted text -


----------------------------------------------------------------------------------------------------------------------

I have another sub that saves perfectly using this method:

sPath = strpath & "/" & striName & ".xls"

Dim sPathTemp As String

'Workbooks.CheckOut xlFile
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

....all variables have been dimmed appropriately.

This code will not work:

SaveFile = Left(imgElement.Title, 27)
Set xlApp = New Excel.Application
buildsavedest = ActiveWorkbook.Path & "/" & SaveFile
xlApp.Workbooks(SaveFile).SaveAs buildsavedest

'SaveFile' gets the correct value.

'buildsavedest' gets the correct value.

The code erros on this line:

xlApp.Workbooks(SaveFile).SaveAs buildsavedest

Again, I'm getting a Run-time Error 9
Subscript out of range
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default How to save a WorkBook to SharePoint?

On Jul 22, 1:31*pm, ryguy7272 wrote:
On Jul 22, 9:23*am, ryguy7272 wrote:





On Jul 21, 7:16*pm, "Jim Cone" wrote:


I am not going to be able to be any further help (hindrance) to you.
There are too many things I don't know about SharePoint.
For instance, is the Excel app on your computer even aware of workbooks on the server?
If not your current efforts with the string name are not going to help you.
A quick web search, "workbooks in sharepoint", turned up several possible useful links - if you speak the programming
language involved. (I don't)
--
Jim Cone
Portland, Oregon *USA


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


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!!!


---------------------------------------------------------------------------**--------------------------------------
Here's my code now:


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


I'm using this: *Left(UCase(imgElement.Title), 27)


To capture the name of the fiel that I want to save to SharePoint.
When I F8 through the code and mouse-over 'SaveThis', I can see that
the variable has the correct value...Excel just refuses to save the
file to SharePoint.


Even if I do this...


Set SaveWB = ThisWorkbook
Set SaveWB = Workbooks("SaveThis.xls")


just to test it...it still doesn't work...


Any ideas on this?


Thanks everyone!!- Hide quoted text -


- Show quoted text -


---------------------------------------------------------------------------*-------------------------------------------

I have another sub that saves perfectly using this method:

* * sPath = strpath & "/" & striName & ".xls"

* * * * * * Dim sPathTemp As String

* * * * * * 'Workbooks.CheckOut xlFile
* * * * * * 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

...all variables have been dimmed appropriately.

This code will not work:

SaveFile = Left(imgElement.Title, 27)
Set xlApp = New Excel.Application
buildsavedest = ActiveWorkbook.Path & "/" & SaveFile
xlApp.Workbooks(SaveFile).SaveAs buildsavedest

'SaveFile' gets the correct value.

'buildsavedest' gets the correct value.

The code erros on this line:

xlApp.Workbooks(SaveFile).SaveAs buildsavedest

Again, I'm getting a Run-time Error 9
Subscript out of range- Hide quoted text -

- Show quoted text -


Ok, so I actually got this working and I wanted to share my code for
the benefit of others. This is how you save a file to SharePoint:
sPath = strpath & "/" & SaveFile
Dim sPathTemp As String
Set xlApp = New Excel.Application
xlApp.Visible = True
Set WB = xlApp.Workbooks.Open(sPath, , False)
xlApp.Workbooks.Application.CalculateFull
Application.DisplayAlerts = False
buildsavedest = sPath
xlApp.Workbooks(SaveFile).SaveAs buildsavedest
Application.DisplayAlerts = True

SaveFile is parsed, as such:
SaveFile = Left(imgElement.Title, 27)

That's simply the file that I'm saving.

The only thing that's I'm struggling with now is to be able to undo
the CheckOut Property (or set the CheckIn Property). Does anyone know
how to do this???
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to save a WorkBook to SharePoint? ryguy7272[_2_] Excel Programming 0 July 21st 10 11:25 PM
How to save a WorkBook to SharePoint? ryguy7272[_2_] Excel Programming 1 July 21st 10 11:05 PM
Saving files to Sharepoint site: error 1004 (can't save file) Harry Excel Programming 2 March 23rd 10 07:07 PM
Sharing Workbook on SharePoint by many users and Save on SharePo Jay Excel Discussion (Misc queries) 0 August 28th 09 04:20 PM
Macro to Save to Sharepoint Jay Gill Excel Programming 0 July 12th 07 08:18 PM


All times are GMT +1. The time now is 11:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"