SaveAs and relative path

  • Thread starter Thread starter dev
  • Start date Start date
D

dev

Hello,
I am trying to save a Workbook object using the Excel 9.0 Object library
and VB.Net. I am executing this statement:

oBook.SaveAs(ReportPath & Me.txtFileName.Text)

where 'ReportPath & Me.txtFileName.Text' resolves to '..\Serial
Worksheets\myFile.txt'. This is being saved from an exe in a 'bin'
directory on the same level as the 'Serial Worksheets' directory. Like:

_Project
|_ bin <==exe lives here
|_Serial Worksheets <==workbook should save here

The SaveAs method fails because it is trying to save the workbook up 3
levels from the bin directory where Serial Worksheets does not exist.
Anyone have any ideas what is going on?

TIA,
Steve
 
Hi Dev,
The SaveAs method fails because it is trying to save the workbook up 3
levels from the bin directory where Serial Worksheets does not exist.
Anyone have any ideas what is going on?

I think the ReportPath will need to be a fully-qualified path, not a
relative one.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.co.uk
 
Back
Top