Convert Excel To Exe File Using VB6

110 Views Asked by At

Hi guys i need a little bit of help. I have the following code in VB6 that i use to run my excel file. I compile the code in the VB6 userform into an exe file and when i open the vb6 file it automatically runs the excel file

    Option Explicit

    Private Sub Form_Load()
    Dim xlApp As Object
    Dim xlWkb As Object
    Dim xlWkbName As String
    Dim xlWkbPath As String

    On Error Resume Next

    Set xlApp = CreateObject("Excel.application")

    xlWkbName = "GCR Client Invoice.xlsm"

    xlWkbPath = App.Path

    Set xlWkb = xlApp.WorkBooks.Open(xlWkbPath & "\" & xlWkbName)


    Set xlWkb = Nothing

    xlApp.application.quit
    
    Unload Me

    End Sub

After that i compile both the VB6 file and my Excel file into an exe file that can be installed on any computer.

The challenge i am now facing is that having installed the exe file, i am able to run my excel file but on closing my excel userform i get this notification that there is another excel file with the same name stored at the same location and that do i want to replace it as seen in the screen shot attached.

Screen Notification

I would be grateful if i can get any help as to how to deal with this challenge. Thanks

0

There are 0 best solutions below