Reply

Join Date: Jul 2007
Posts: 2
Reputation: Friendly Shark is an unknown quantity at this point 
Solved Threads: 0
Friendly Shark Friendly Shark is offline Offline
Newbie Poster

Excel in VB 6

 
0
  #1
Jul 29th, 2007
How do I insert an Excel file into VB 6. I need to be able to view the file in a seperate form. I know the coding to change the forms is

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Form1.Hide
  2. Form2.Show

And I read a previous thread before on these forums that gave me the coding to load it:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim xlTmp As Excel.Application
  2.  
  3. Set xlTmp = New Excel.Application
  4. xlTmp.Workbooks.Open App.Path & "\times.xls"

Could anyone please help me to find what the solution so the Excel spreadsheet may be displayed on the form?
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 2
Reputation: Friendly Shark is an unknown quantity at this point 
Solved Threads: 0
Friendly Shark Friendly Shark is offline Offline
Newbie Poster

Re: Excel in VB 6

 
0
  #2
Aug 2nd, 2007
Bump

Could someone please help
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 42
Reputation: guru511 is an unknown quantity at this point 
Solved Threads: 3
guru511's Avatar
guru511 guru511 is offline Offline
Light Poster

Re: Excel in VB 6

 
0
  #3
Aug 2nd, 2007
Dim xlApp As Excel.Application
Dim wb As Workbook
Dim ws As Worksheet
Dim i As Integer
Dim stre As String
Set xlApp = New Excel.Application

Set wb = xlApp.Workbooks.Open("C:\Documents and Settings\c5098466\My Documents\Guru\Solution Tracker\Notefix Tracker1.xls")

Set ws = wb.Worksheets("Sheet1")
'Give your worksheet name
stre = ""
For i = 1 To 10
For j = 1 To 12
stre = stre & ws.cells(i, j).Value & vbTab
'Print (ws.cells(i, j).Value)
'Do whatever u want here
Next
stre = stre & vbCrLf
Next
wb.Close
Print stre
xlApp.Quit

Set ws = Nothing
Set wb = Nothing
Set xlApp = Nothing



here how can i specify the EOF in the for loops
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 7
Reputation: markx_018 is an unknown quantity at this point 
Solved Threads: 0
markx_018 markx_018 is offline Offline
Newbie Poster

Re: Excel in VB 6

 
0
  #4
Aug 2nd, 2007
i have a problem can you help me? here`s my problem,can you help me how to make an inventory system..plzzzzz
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Excel in VB 6

 
0
  #5
Aug 2nd, 2007
Hi Markx,

Post ur own thread.
ur problem may go unnoticed if u Post in other threads.
And what is the Kind/Nature of business u want to develop the inventory..?

Regards
Veena

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Excel in VB 6

 
0
  #6
Aug 2nd, 2007
Hi, Guru,

u need to check if all the cell Values r blank continously and come out of the loop

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 42
Reputation: guru511 is an unknown quantity at this point 
Solved Threads: 3
guru511's Avatar
guru511 guru511 is offline Offline
Light Poster

Re: Excel in VB 6

 
0
  #7
Aug 2nd, 2007
hi veena..
i got how to go till the last used row..
i used

Dim ra As Excel.Range
Set rang = ws.UsedRange

' and then i used
ra.Rows.Count
ra.columns.count


that solved my purpose
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 42
Reputation: guru511 is an unknown quantity at this point 
Solved Threads: 3
guru511's Avatar
guru511 guru511 is offline Offline
Light Poster

Re: Excel in VB 6

 
0
  #8
Aug 2nd, 2007
hi veena..
i got how to go till the last used row..
i used

Dim ra As Excel.Range
Set rang = ws.UsedRange

' and then i used
ra.Rows.Count
ra.columns.count


that solved my purpose
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: Excel in VB 6

 
0
  #9
Aug 2nd, 2007
Hi Guru,

Good to know that u cud solve it..
and posted here so that every one can use it..

Regards
Veena
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC