Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VBA Code to open an Excel file on a sharepoint site

199 views
Skip to first unread message

Vit

unread,
Sep 3, 2008, 9:57:29 PM9/3/08
to
Hi all,

I'm trying to write a macro on an excel file that open another excel
file (stored on a sharepoint site), copy and paste some data...

the problem is to open the file stored in the sharepoint site...

I'm using this:

Application.FollowHyperlink "http://test:8080/PWA/Project Documents/00
MS Excel File/Direct Cost Summary.xls", , , True

the problem is that in this way I'm opening the file in "Read Only"...

where, in the VBA can I set this value????

thanks all

Cheers

Vit

Vit

unread,
Sep 3, 2008, 11:15:09 PM9/3/08
to
I have foud it....

Workbooks.CanCheckOut....

thanks anyway

cheers

Vit

Message has been deleted

Vit

unread,
Sep 3, 2008, 11:59:33 PM9/3/08
to
hi all again...

I have some problems.....

here you are the VBA code that I'm using....

Sub UseCanCheckOut()

Dim xlFile As String
xlFile = "http://Test:8080/PWA//Project Documents/00 MS Excel File/
Direct Cost Summary.xls"

' Determine if workbook can be checked out.
If Workbooks.CanCheckOut(xlFile) = True Then

Workbooks.CheckOut xlFile

Application.FollowHyperlink xlFile, , , True

Else
MsgBox "You are unable to check out this document at this
time."
End If

End Sub

with this code I can Check Out the File (I can see it on the
WorkSpace...), but when I'm going to open with
application.followhyperlink, it still opens the file in "Read
Only"....

how can I open the file and edit it???

thanks

Vit

> > Vit- Hide quoted text -
>
> - Show quoted text -

Vit

unread,
Sep 4, 2008, 3:02:08 AM9/4/08
to
Now it works...

here you are the code:


Sub UseCanCheckOut()


Dim xlApp As Excel.Application
Dim wb As Workbook
Dim xlFile As String
xlFile = "http://test:8080/PWA/Project Documents/00 MS Excel
File/
BookTest.xls"


'Determine if workbook can be checked out.


If Workbooks.CanCheckOut(xlFile) = True Then
Workbooks.CheckOut xlFile


Set xlApp = New Excel.Application
xlApp.Visible = True


Set wb = xlApp.Workbooks.Open(xlFile, , False)


MsgBox wb.Name & " is checked out to you."


Else
' MsgBox "You are unable to check out this document at this
time."
End If


End Sub


Cheers

vit

palkar

unread,
Jul 13, 2010, 6:17:29 PM7/13/10
to
Hi I am trying to open an excel file on sharepoint site.

Application.FollowHyperlink "http://localhost:xxxx/xltblts/btTest1.xls", , True

There is an error message saying ,

compile error:
Invalid outside procedure.


I am writing this Macro in MS Access and trying to read an excel file.

Also, I want to know if sharepoint site ceredentials are in the way and if so how to provide them in the macro.

Can you kindly shed some light on this?

Thank you

Vit wrote:

Now it works...
06-Sep-08

Now it works...


Sub UseCanCheckOut()


End Sub


Cheers

vit

Previous Posts In This Thread:

On Saturday, September 06, 2008 1:13 PM
Vit wrote:

VBA Code to open an Excel file on a sharepoint site
Hi all,

I'm trying to write a macro on an excel file that open another excel
file (stored on a sharepoint site), copy and paste some data...

the problem is to open the file stored in the sharepoint site...

I'm using this:

Application.FollowHyperlink "http://test:8080/PWA/Project Documents/00


MS Excel File/Direct Cost Summary.xls", , , True

the problem is that in this way I'm opening the file in "Read Only"...

where, in the VBA can I set this value????

thanks all

Cheers

Vit

On Saturday, September 06, 2008 1:13 PM
Vit wrote:

I have foud it....Workbooks.CanCheckOut....
I have foud it....

Workbooks.CanCheckOut....

thanks anyway

cheers

Vit

On Saturday, September 06, 2008 1:13 PM
Vit wrote:

hi all again...I have some problems.....
hi all again...

I have some problems.....

here you are the VBA code that I'm using....

Sub UseCanCheckOut()

Dim xlFile As String
xlFile =3D "http://Test:8080/PWA//Project Documents/00 MS Excel File/
Direct Cost Summary.xls"

' Determine if workbook can be checked out.
If Workbooks.CanCheckOut(xlFile) =3D True Then

Workbooks.CheckOut xlFile

Application.FollowHyperlink "http://usa-apps:8080/PWA/QBT - PM
Process 2/Project Documents/00 MS Excel File/Direct Cost


Summary.xls", , , True

Else


MsgBox "You are unable to check out this document at this
time."
End If

End Sub

with this code I can Check Out the File (I can see it on the


WorkSpace...), but when I'm going to open with
application.followhyperlink, it still opens the file in "Read
Only"....

how can I open the file and edit it???

thanks

Vit

On Sep 4, 11:15=A0am, Vit <FiNa...@gmail.com> wrote:

On Saturday, September 06, 2008 1:13 PM
Vit wrote:

hi all again...I have some problems.....
hi all again...

I have some problems.....

here you are the VBA code that I'm using....

Sub UseCanCheckOut()

Dim xlFile As String
xlFile =3D "http://Test:8080/PWA//Project Documents/00 MS Excel File/
Direct Cost Summary.xls"

' Determine if workbook can be checked out.
If Workbooks.CanCheckOut(xlFile) =3D True Then

Workbooks.CheckOut xlFile

Application.FollowHyperlink xlFile, , , True

Else


MsgBox "You are unable to check out this document at this
time."
End If

End Sub

with this code I can Check Out the File (I can see it on the


WorkSpace...), but when I'm going to open with
application.followhyperlink, it still opens the file in "Read
Only"....

how can I open the file and edit it???

thanks

Vit


On Sep 4, 11:15=A0am, Vit <FiNa...@gmail.com> wrote:

On Saturday, September 06, 2008 1:13 PM
Vit wrote:

Now it works...
Now it works...


Sub UseCanCheckOut()


End Sub


Cheers

vit


Submitted via EggHeadCafe - Software Developer Portal of Choice
ASP.NET GridView: Select Row and Display Item Detail
http://www.eggheadcafe.com/tutorials/aspnet/ff14a008-2af9-4f9d-a09d-1af670466a80/aspnet-gridview-select-row-and-display-item-detail.aspx

0 new messages