Results 1 to 5 of 5

Thread: VB6 exe file to launch office 2016 file will not work.

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2017
    Posts
    2

    VB6 exe file to launch office 2016 file will not work.

    I am trying to have a vb executable launch a Microsoft excel file, yet the script I have put together is not working. I have troubleshooted the code and I am running it without any errors but no action happens. I have ran the code and debugged the file path and it references the correct location. I am using excel 2016 and it looks to me like this might be related to the object reference libraries. Excel doesn't have a specific reference for 2016 as I have seen in the past for other versions, (I am seeing a similar issue with winsock references). the script is as follows any suggestions will help:

    Code:
        Dim object_excelApp As Object 'Excel.Application
        Dim appPath As String
        Dim excelwb As Object ' Excel.Workbook
    
            Set object_excelApp = CreateObject("Excel.Application")
            'ppPath = My.Application.Info.DirectoryPath()
            AppFilePath = App.Path
            FileParse = AppFilePath & "Testfile.xlsm"
            Set excelwb = object_excelApp.Workbooks.Open(FileParse)

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,904

    Re: VB6 exe file to launch office 2016 file will not work.

    App.Path does not have a trailing "\", so modify your code to the following:
    Code:
    FileParse = AppFilePath & "\Testfile.xlsm"

  3. #3
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,836

    Re: VB6 exe file to launch office 2016 file will not work.

    So then I guess:

    I have ran the code and debugged the file path and it references the correct location.
    Wasn't true
    Please remember next time...elections matter!

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2017
    Posts
    2

    Re: VB6 exe file to launch office 2016 file will not work.

    I actually tried it both ways, since AppFilePath (as seen in the attachment) already included the "\" it looked like the correct path would be without. But with or without the "\" the script is not opening the file as intended.

    Name:  filepath.jpg
Views: 953
Size:  29.5 KB

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: VB6 exe file to launch office 2016 file will not work.

    you may be getting some message about opening a file with macros, test with an .xlsx
    or make the excelapp visible before trying to open the file, to see if a dialog is shown
    you could try excelapp.displayalerts = false
    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

Posting Permissions

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



Click Here to Expand Forum to Full Width