User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 423,539 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,257 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 1108 | Replies: 4 | Solved
Reply
Join Date: Dec 2007
Posts: 14
Reputation: P90K is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
P90K's Avatar
P90K P90K is offline Offline
Newbie Poster

Question vb6-excel problem

  #1  
Dec 15th, 2007
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2007
Posts: 14
Reputation: P90K is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
P90K's Avatar
P90K P90K is offline Offline
Newbie Poster

Re: vb6-excel problem

  #2  
Dec 18th, 2007
is there no one who can help me ???????

all info can help.
Reply With Quote  
Join Date: Aug 2007
Location: KSA
Posts: 147
Reputation: kb.net is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 26
kb.net's Avatar
kb.net kb.net is offline Offline
Junior Poster

Re: vb6-excel problem

  #3  
Dec 18th, 2007
Hi,

[code]xlApp.ActiveWorkbook.Close True, App.Path & "\gegevens.xls"
xlApp.Quit
Set xlApp = Nothing[/close]
It is never about the number of languages you know, you either have the logic of programming or you don't ...

Some of the codes I post are collected from different sites during the past couple of years, so I would like to thank them for their help and for enabling me to help.
Reply With Quote  
Join Date: Dec 2007
Posts: 14
Reputation: P90K is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
P90K's Avatar
P90K P90K is offline Offline
Newbie Poster

Re: vb6-excel problem

  #4  
Dec 18th, 2007
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?????
Reply With Quote  
Join Date: Dec 2007
Posts: 14
Reputation: P90K is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
P90K's Avatar
P90K P90K is offline Offline
Newbie Poster

Re: vb6-excel problem

  #5  
Dec 18th, 2007
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 5:37 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC