Here's what I have done with Neil's approach:I use this as a Private function throughout my assemblies and works well when I have support files that need to be accessed or written to and are/have been deployed with the application when installed.Private Function GetAppPath() As String
Dim path As String
path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.Location)
Return path
End Function
So to use this, here is an example of how I might setup a connection string to an Excel file that was included in the original deployment/install of the application:Dim m_sConn1 As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & GetAppPath() & "\" & inDist & ".xlsx;;Extended Properties=""Excel 12.0 Xml;HDR=Yes"""
Dim ExcelConnection As New System.Data.OleDb.OleDbConnection(m_sConn1)
ExcelConnection.Open()