Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default CheckOut/CheckIn from/to SharePoint 2010

Nick H submitted this idea :
Yes, this works...

Private mXlApp As Excel.Application

Sub SPCheckOut(docCheckOut As String)
Set mXlApp = CreateObject("Excel.Application")
' Determine if workbook can be checked out.
If mXlApp.Workbooks.CanCheckOut(docCheckOut) = True Then
mXlApp.Workbooks.Open Filename:=docCheckOut
mXlApp.Workbooks.CheckOut docCheckOut
mXlApp.Visible = True
Else
MsgBox "Unable to check out this document at this time."
End If
End Sub

Sub SPCheckIn(docCheckIn As String)
' Determine if workbook can be checked in.
If mXlApp.Workbooks(docCheckIn).CanCheckIn = True Then
mXlApp.Workbooks(docCheckIn).CheckIn
Else
MsgBox "This file cannot be checked in at this time. Please
try again later."
End If
End Sub

Obvioulsy mXlApp should be disposed of properly elsewhere when
finished with.

Br, Nick.


mXlApp will be implicitly destroyed when the file containing the code
that created it terminates. However, it would be best to explicitly
destroy it BEFORE the file closes because anything we leave to VBA to
do implicitly requires extra processing on VBA's part. IMO, it's just
good programming practice to explicitly destroy objects we create when
we no longer need them.

Example:
Set mXlApp = Nothing

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


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
Mark if checkin date is within 30 days of checkout date where name isthe same. steve1040 Excel Programming 4 July 13th 10 07:41 AM
How to CheckIn a checked out file in VBA? Revolvr Excel Programming 0 August 12th 09 08:12 PM
Method 'CheckIn' of object '_workbook' failed Bill Schanks Excel Programming 1 May 9th 06 10:04 PM
Checkin into SPS prompts no matter what... Lasse Bjerre Knudsen Excel Programming 0 June 29th 04 08:46 AM


All times are GMT +1. The time now is 08:41 AM.

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

About Us

"It's about Microsoft Excel"