Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Save a file to SharePoint


I know this code was working yesterday; today it is NOT working:

SaveFile comes from parsing a string, as such:
SaveFile = Left(imgElement.Title, 27)

Here’s the code that I was using to save a file to SharePoint, and
make the status of the file NOT checkedout.

Dim bk As Workbook
Dim APP As Excel.Application
Dim obj
Set bk = Workbooks(SaveFile)
Set APP = bk.Parent
APP.Workbooks(SaveFile).CheckIn
bk.Activate
bk.CheckIn
Workbooks(SaveFile).Activate
Workbooks(SaveFile).Save
Workbooks(SaveFile).CheckIn
bk.undocheckout

It seems to be very simple to check in ThisWorkbook, but very
difficult to checkin another file that is NOT ThisWorkbook.

Any ideas on how to do this?

As always, thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Save a file to SharePoint

On Jul 24, 2:48*pm, ryguy7272 wrote:
I know this code was working yesterday; today it is NOT working:

SaveFile comes from parsing a string, as such:
SaveFile = Left(imgElement.Title, 27)

Here’s the code that I was using to save a file to SharePoint, and
make the status of the file NOT checkedout.

Dim bk As Workbook
Dim APP As Excel.Application
Dim obj
Set bk = Workbooks(SaveFile)
Set APP = bk.Parent
APP.Workbooks(SaveFile).CheckIn
bk.Activate
bk.CheckIn
Workbooks(SaveFile).Activate
Workbooks(SaveFile).Save
Workbooks(SaveFile).CheckIn
bk.undocheckout

It seems to be very simple to check in ThisWorkbook, but very
difficult to checkin another file that is NOT ThisWorkbook.

Any ideas on how to do this?

As always, thanks!



Ok, so I actually got this working and I wanted to share my code for
the benefit of others:
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 knwo
how to do this???
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Save a file to SharePoint

On Jul 24, 5:23*pm, ryguy7272 wrote:
On Jul 24, 2:48*pm, ryguy7272 wrote:





I know this code was working yesterday; today it is NOT working:


SaveFile comes from parsing a string, as such:
SaveFile = Left(imgElement.Title, 27)


Here’s the code that I was using to save a file to SharePoint, and
make the status of the file NOT checkedout.


Dim bk As Workbook
Dim APP As Excel.Application
Dim obj
Set bk = Workbooks(SaveFile)
Set APP = bk.Parent
APP.Workbooks(SaveFile).CheckIn
bk.Activate
bk.CheckIn
Workbooks(SaveFile).Activate
Workbooks(SaveFile).Save
Workbooks(SaveFile).CheckIn
bk.undocheckout


It seems to be very simple to check in ThisWorkbook, but very
difficult to checkin another file that is NOT ThisWorkbook.


Any ideas on how to do this?


As always, thanks!


Ok, so I actually got this working and I wanted to share my code for
the benefit of others:
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 knwo
how to do this???- Hide quoted text -

- Show quoted text -



As it turns out, this seems to do the trick:
xlApp.Workbooks(SaveFile).SaveAs buildsavedest
xlApp.Workbooks(SaveFile).CheckIn SaveChanges:=True, _
Comments:=""

Hope this helps others…
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Save a file to SharePoint

On Jul 24, 3:34*pm, ryguy7272 wrote:
On Jul 24, 5:23*pm, ryguy7272 wrote:



On Jul 24, 2:48*pm, ryguy7272 wrote:


I know this code was working yesterday; today it is NOT working:


SaveFile comes from parsing a string, as such:
SaveFile = Left(imgElement.Title, 27)


Here’s the code that I was using to save a file to SharePoint, and
make the status of the file NOT checkedout.


Dim bk As Workbook
Dim APP As Excel.Application
Dim obj
Set bk = Workbooks(SaveFile)
Set APP = bk.Parent
APP.Workbooks(SaveFile).CheckIn
bk.Activate
bk.CheckIn
Workbooks(SaveFile).Activate
Workbooks(SaveFile).Save
Workbooks(SaveFile).CheckIn
bk.undocheckout


It seems to be very simple to check in ThisWorkbook, but very
difficult to checkin another file that is NOT ThisWorkbook.


Any ideas on how to do this?


As always, thanks!


Ok, so I actually got this working and I wanted to share my code for
the benefit of others:
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 knwo
how to do this???- Hide quoted text -


- Show quoted text -


As it turns out, this seems to do the trick:
xlApp.Workbooks(SaveFile).SaveAs buildsavedest
xlApp.Workbooks(SaveFile).CheckIn SaveChanges:=True, _
* * * * * * * * * * * * * * * * * * * * * * Comments:=""

Hope this helps others…



Got it working!! I had some help from a colleague in my office.
Thanks Mandeep!!
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? Jim Cone[_2_] Excel Programming 3 July 24th 10 10:28 PM
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
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 07:03 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"