ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SaveAs and relative path (https://www.excelbanter.com/excel-programming/285819-saveas-relative-path.html)

dev[_2_]

SaveAs and relative path
 
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



Stephen Bullen

SaveAs and relative path
 
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



dev[_3_]

SaveAs and relative path
 
Thanks!

"Stephen Bullen" wrote in message
...
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






All times are GMT +1. The time now is 01:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com