Using the Internet for Storing Workbooks

The simplest way of sharing information is to store workbooks on a web server. Though Excel 97 introduced the ability to download workbooks from web sites, Excel 2000 and 2007 extended that to allow you to save workbooks as well. They do this by using the FrontPage Server Extensions, which must be running on the server. To open and save a workbook from or to a web site, use the URL instead of the filename:

Sub OpenFromWebSiteAndSaveBack() Dim oBk As Workbook 'Open a workbook from a web site

Set oBk = Workbooks.Open("http://www.MySite.com/book1.xlsx")

'Save the workbook to the web site with a new name oBk.SaveAs "http://www.MySite.com/Book2.xlsx"

End Sub

If the server requires you to log on, you have the option of letting Excel prompt for the ID and password each time (as in the preceding example), or include the ID and password as part of the URL:

Sub OpenFromSecureWebSiteAndSaveBack()

Dim oBk As Workbook

'Open a workbook from a web site

Set oBk = Workbooks.Open("http://UserID:[email protected]/book1.xlsx")

'Save the workbook to the web site with a new name oBk.SaveAs "http://UserID:[email protected]/Book2.xlsx"

End Sub

The URLs can, of course, also be used in Excel's Office Menu O Open and Save As dialogs.

0 0

Post a comment