Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Mark if checkin date is within 30 days of checkout date where name isthe same. | Excel Programming | |||
How to CheckIn a checked out file in VBA? | Excel Programming | |||
Method 'CheckIn' of object '_workbook' failed | Excel Programming | |||
Checkin into SPS prompts no matter what... | Excel Programming |