Excel Relative Path

MissingLink

Member
Joined
Feb 20, 2009
Messages
7
Programming Experience
3-5
Hi there

I am busy using an existing Excel workbook to generate quotes, but at the moment the path to the workbook is absolutely referenced.

VB.NET:
Dim wb As Excel.Workbook = excel.Workbooks.Open("C:\Users\Bob\Documents\Visual Studio 2008\Projects\Quoter\bin\Debug\Quote.xls")

How do I use relative referencing on this?
 
Relative to Documents folder?
VB.NET:
Dim absPath As String = IO.Path.Combine(My.Computer.FileSystem.SpecialDirectories.MyDocuments, "subfolder\file.ext")
 
Preferably you should then use the designated application folders to store data files, ie one of these:
VB.NET:
Application.CommonAppDataPath 
Application.LocalUserAppDataPath / Application.UserAppDataPath
 
Back
Top