Im new whith vb6, i onley now de basic of it.
but i have a problem with excel.

I opend and existing excel file with vb6 in a private sub.

Dim xlApp As Excel.Application 'Nodig voor werken met excel
Set xlApp = New Excel.Application 'excel openen
xlApp.Visible = True
xlApp.Workbooks.Open (App.Path & "\gegevens.xls")
i = 0
List1.Clear
Do
    i = i + 1
    vgl = xlApp.ActiveSheet.Cells(i, 1)
    If vgl <> "" Then
        List1.AddItem vgl
    End If
Loop While vgl <> ""

and i want to close the file in an other private sub.
dis doesn't work and i don't now what im doing rwong???

this is the code,

Dim xlApp As New Excel.Application
Windows("gegevens.xls").Activate
ActiveWorkbook.Close savechanges:=True
xlApp.Quit

End

can somone help me please.

thanx

Recommended Answers

All 4 Replies

is there no one who can help me :( ???????

all info can help.

Hi,

xlApp.ActiveWorkbook.Close True, App.Path & "\gegevens.xls"
xlApp.Quit
Set xlApp = Nothing

stille doesn't work. :(
vb still gives an error by following line:

xlApp.ActiveWorkbook.Close True, App.Path & "\gegevens.xls"

i have also tryed

xlApp.ActiveWorkbook.Close True

but vb always errors at those lines?????

thanx for your help but i alrady found the problem
i don't now why but in stat of xlapp.quit it supose te be
application.quit.

it works with the code below

Dim xlApp As New Excel.Application
Windows("gegevens.xls").Activate
ActiveWorkbook.Close savechanges:=True
Application.Quit

now vb closed excel to.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.