PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Check an a file; SharePoint

 
 
ryguy7272
Guest
Posts: n/a
 
      23rd Jul 2010
I’m following the example here:
http://msdn.microsoft.com/en-us/library/aa223808(office.11).aspx

Here’s my code:
' Determine if workbook can be checked in.
If Workbooks(SaveFile).CanCheckIn = True Then
Workbooks(SaveFile).CheckIn
MsgBox SaveFile & " has been checked in."
Else
MsgBox "This file cannot be checked in " & _
"at this time. Please try again later."
End If

‘SaveFile’ is dimmed as a string; it is the name of my Excel file,
which comes from here:
SaveFile = Left(imgElement.Title, 27)

I mouse-over the variable and see that the value is correct, but the
code fails on this line:
If Workbooks(SaveFile).CanCheckIn = True Then

SaveFile is checked out from SharePoint. How come I can’t check it
in? Do I need to fully qualify SaveFile with the path to SharePoint
so Excel knows WHERE to check the file in?

I’d appreciate any ideas with this.

Thanks!!
Ryan---
 
Reply With Quote
 
 
 
 
ryguy7272
Guest
Posts: n/a
 
      24th Jul 2010
On Jul 23, 2:18*pm, ryguy7272 <ryanshu...@gmail.com> wrote:
> I’m following the example here:http://msdn.microsoft.com/en-us/library/aa223808(office.11).aspx
>
> Here’s my code:
> ' Determine if workbook can be checked in.
> If Workbooks(SaveFile).CanCheckIn = True Then
> Workbooks(SaveFile).CheckIn
> MsgBox SaveFile & " has been checked in."
> Else
> MsgBox "This file cannot be checked in " & _
> "at this time. *Please try again later."
> End If
>
> ‘SaveFile’ is dimmed as a string; it is the name of my Excel file,
> which comes from here:
> SaveFile = Left(imgElement.Title, 27)
>
> I mouse-over the variable and see that the value is correct, but the
> code fails on this line:
> If Workbooks(SaveFile).CanCheckIn = True Then
>
> SaveFile is checked out from SharePoint. *How come I can’t check it
> in? *Do I need to fully qualify SaveFile with the path to SharePoint
> so Excel knows WHERE to check the file in?
>
> I’d appreciate any ideas with this.
>
> Thanks!!
> Ryan---


Ok, so I (kind of) got this working and I wanted to share my code for
the benefit of others. This will 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 With Quote
 
ryguy7272
Guest
Posts: n/a
 
      24th Jul 2010
On Jul 24, 5:25*pm, ryguy7272 <ryanshu...@gmail.com> wrote:
> On Jul 23, 2:18*pm, ryguy7272 <ryanshu...@gmail.com> wrote:
>
>
>
>
>
> > I’m following the example here:http://msdn.microsoft.com/en-us/library/aa223808(office.11).aspx

>
> > Here’s my code:
> > ' Determine if workbook can be checked in.
> > If Workbooks(SaveFile).CanCheckIn = True Then
> > Workbooks(SaveFile).CheckIn
> > MsgBox SaveFile & " has been checked in."
> > Else
> > MsgBox "This file cannot be checked in " & _
> > "at this time. *Please try again later."
> > End If

>
> > ‘SaveFile’ is dimmed as a string; it is the name of my Excel file,
> > which comes from here:
> > SaveFile = Left(imgElement.Title, 27)

>
> > I mouse-over the variable and see that the value is correct, but the
> > code fails on this line:
> > If Workbooks(SaveFile).CanCheckIn = True Then

>
> > SaveFile is checked out from SharePoint. *How come I can’t check it
> > in? *Do I need to fully qualify SaveFile with the path to SharePoint
> > so Excel knows WHERE to check the file in?

>
> > I’d appreciate any ideas with this.

>
> > Thanks!!
> > Ryan---

>
> Ok, so I (kind of) got this working and I wanted to share my code for
> the benefit of others. *This will 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???- 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…
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check a file into SharePoint ryguy7272 Microsoft Excel Programming 2 24th Jul 2010 11:35 PM
Check out Excel file from SharePoint; if no other Excel file is op RyGuy Microsoft Excel Programming 0 21st May 2010 10:32 PM
Check Whether SharePoint Group Exists Fao, Sean Microsoft ASP .NET 1 26th Sep 2007 09:22 PM
What's the dif. between EDIT and CHECK OUT in Sharepoint? =?Utf-8?B?Q2hpcA==?= Microsoft Word Document Management 6 28th Jan 2007 07:36 PM
Re: email attachments - check for updates in Sharepoint document works Sue Mosher [MVP-Outlook] Microsoft Outlook Discussion 0 20th Jul 2004 09:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:25 AM.