dcsimg
Results 1 to 2 of 2

Thread: Where is the new Excel workbook created when Access 2000 inside a VS 2005 project?

  1. #1

    Thread Starter
    Lively Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, Macedonia
    Posts
    120

    Where is the new Excel workbook created when Access 2000 inside a VS 2005 project?

    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:

    Code:
    dim sql as string
    
    sql = "SELECT * "
    
    sq = sql & "INTO [ExcelWorksheetName] IN ''[Excel 8.0;Database=" & CurrentProject.Path & "\" & nameOfExcelFile & "] "
    
    sql = sql & "FROM MyTable "
    where CurrentProject.Path is where the mdb file resides.

    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:

    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
    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?

    I Wasn't sure if this is more Visual Studio question than an Office one.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,435

    Re: Where is the new Excel workbook created when Access 2000 inside a VS 2005 project

    i would assume if you specify the full path in nameofexcelfile you would have full control to save the file wherever you wish, apart from protected folders, if no path is specified i would be looking into the default data directory for excel
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width