Open Excel file from Visual Basic

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Open Excel file from Visual Basic

 
0
  #21
Apr 3rd, 2006
Oops, I don't have excel installed....

I thought it was part of the vb project files, I'll check it out
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 5
Reputation: seagull is an unknown quantity at this point 
Solved Threads: 1
seagull seagull is offline Offline
Newbie Poster

Re: Open Excel file from Visual Basic

 
0
  #22
Apr 3rd, 2006
I don't know VB6 but I do have Excel.
In .net I get xlApp.Rows.Count = 65536 (i.e. it doesn't recognise where you've stopped inputting values) . If you get this too, this is your subcript out of range problem, and an unhandled error will stop your cleanup code from running, which is why you still have exes running.
You need a do .. until loop (or similar) and check for an empty cell.
You also need to handle runtime errors and put the set xlApp = nothing etc in this section.
I don't know vb6, so I won't embarass myself by trying to write any code.
Sorry I can't be more helpful but hopefully this helps with the array problem.
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 6
Reputation: harry.net is an unknown quantity at this point 
Solved Threads: 1
harry.net harry.net is offline Offline
Newbie Poster

Re: Open Excel file from Visual Basic

 
0
  #23
Apr 4th, 2006
Originally Posted by seagull
I don't know VB6 but I do have Excel.
In .net I get xlApp.Rows.Count = 65536 (i.e. it doesn't recognise where you've stopped inputting values) . If you get this too, this is your subcript out of range problem, and an unhandled error will stop your cleanup code from running, which is why you still have exes running.
You need a do .. until loop (or similar) and check for an empty cell.
You also need to handle runtime errors and put the set xlApp = nothing etc in this section.
I don't know vb6, so I won't embarass myself by trying to write any code.
Sorry I can't be more helpful but hopefully this helps with the array problem.
Thanks a lot it helped me too much.
I removed xlApp.Rows.Count , I replaced it with an integer number
now my program is working and Excel.EXE is not remaining in task manager any more.


Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. For i = 0 To 200
  2. If xlSht.Cells(j, 1).value = "" Then Exit For
  3. Ucode2(i, 0) = xlSht.Cells(j, 1).value
  4. Ucode2(i, 1) = xlSht.Cells(j, 2).value
  5. j = j + 1
  6. Next

Thanks a lot for those who helped me
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 28
Reputation: mjwest10 is an unknown quantity at this point 
Solved Threads: 3
mjwest10 mjwest10 is offline Offline
Light Poster

Re: Open Excel file from Visual Basic

 
0
  #24
Apr 3rd, 2007
This was very helpful
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC