I recently found out that I can publish a VS 2005 project with all necessary files, like Access 2000 mdb file.
I am using VBA code inside this mdb file to get some data from linked tables and export those data into an Excel file using a query like this:
where CurrentProject.Path is where the mdb file resides.Code:dim sql as string sql = "SELECT * " sq = sql & "INTO [ExcelWorksheetName] IN ''[Excel 8.0;Database=" & CurrentProject.Path & "\" & nameOfExcelFile & "] " sql = sql & "FROM MyTable "
My VS 2005 publishes the mdb file with "Content" and "Copy Always" properties set.
After I open the mdb file with a VB.NET application button and with the code:
All works well with the VBA code inside the mdb, but I don't know where the exported Excel gets created. Can somebody tell me?Code:Try Process.Start(My.Application.Info.DirectoryPath & "\\" & "MyAccess2000.mdb") Catch ex As Exception Dim msg As String = New StackTrace(ex).GetFrame(0).GetMethod().Name & "(): " & ex.Message Console.WriteLine(msg) End Try
I Wasn't sure if this is more Visual Studio question than an Office one.




Reply With Quote
