Storing an Excel sheet as a database resource

I have a scheduled agent that regularly creates and distributes an Excel worksheet with several sheets of data - exported view data, charts, etc… I also have a spreadsheet containing historical statistics that I need to append to this workbook each time I generate the report, and I am struggling with this seemingly minor task. Using Domino Designer, I have imported the spreadsheet as a Shared Resource into the Files folder, but I am not able to correctly specify the path to open the file.

Set db = session.currentdatabase



Path=db.FilePath



Set xlApp = createObject("Excel.application")

xlapp.visible=True



xlapp.SheetsInNewWorkbook = 4

xlapp.workbooks.add



Gosub ExportAllDocsView	// creates and populates xlsheet1

Gosub SummarizeCategories // creates and populates xlsheet2

Gosub CreateChart1 // creates and populates xlsheet3

Gosub CreateChart2 // creates and populates xlsheet4

//Here’s the failure point:

xlapp.workbooks.open(Path + "\Pre 2003 Data.xls")

// The error window is as follows:

//Lotus Notes

//Microsoft Excel: ‘c\lotus\notes\data\MyDatabase.nsf\Pre 2003 Data.xls’ could not be found. Check the spelling of the file name, and verify that the file location is correct.

//If you are trying to open the file from your list of most recently used files on the File menu, make sure that the file has not been renamed, moved, or deleted.

xlapp.Sheets("Historical data").Select

xlapp.Sheets("Historical data").Copy Null,xlsheet4	

On Error Resume Next

If I hard code the path to my local copy of the document it works perfectly. It is important that I embed this spreadsheet in the database, since I have no influence over where our administration group chooses to deploy the database.

Is it possible to refer to this document by path? Based on the help documents, it seems like the approach I have used should work. Any suggestions would be greatly appreciated - thanks very much!

Subject: Storing an Excel sheet as a database resource

The “path” is virtual, and only works as a URL. As far as the file system is concerned, the database file is the end of the line.

Subject: RE: Storing an Excel sheet as a database resource

Thanks for clarifying for me - now that I know that, I was able to use the URL to open the shared resource file spreadsheet I imported and stored in the database:

Set db = session.currentdatabase

Dim server As New NotesName(db.server)

serverName = Format(server.Common, “<”)

Path = db.filepath

filePath = Replace(Path, "", “/”)

docPath = “http://” + serverName + “.mydomain.com/”+ filePath + “/Pre%202003%20Data.xls”

Set xlApp = createObject(“Excel.application”)

xlapp.visible=True

xlapp.SheetsInNewWorkbook = 4

xlapp.workbooks.add

Gosub ExportAllDocsView // creates and populates xlsheet1

Gosub SummarizeCategories // creates and populates xlsheet2

Gosub CreateChart1 // creates and populates xlsheet3

Gosub CreateChart2 // creates and populates xlsheet4

xlapp.workbooks.open(Path + “\Pre 2003 Data.xls”)

xlapp.Sheets(“Historical data”).Copy Null,xlsheet4

On Error Resume Next

Works great! Thanks again!