0

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

2
Contributors
4
Replies
8
Views
9 Years
Discussion Span
Last Post by P90K
0

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

all info can help.

0

Hi,

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

Edited by happygeek: fixed formatting

0

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

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.