944,003 Members | Top Members by Rank

Ad:
Jul 29th, 2007
0

Excel in VB 6

Expand Post »
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?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Friendly Shark is offline Offline
2 posts
since Jul 2007
Aug 2nd, 2007
0

Re: Excel in VB 6

Bump

Could someone please help
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Friendly Shark is offline Offline
2 posts
since Jul 2007
Aug 2nd, 2007
0

Re: Excel in VB 6

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
Reputation Points: 10
Solved Threads: 3
Light Poster
guru511 is offline Offline
42 posts
since Jul 2007
Aug 2nd, 2007
0

Re: Excel in VB 6

i have a problem can you help me? here`s my problem,can you help me how to make an inventory system..plzzzzz
Reputation Points: 10
Solved Threads: 0
Newbie Poster
markx_018 is offline Offline
7 posts
since Aug 2007
Aug 2nd, 2007
0

Re: Excel in VB 6

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
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
Aug 2nd, 2007
0

Re: Excel in VB 6

Hi, Guru,

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

Regards
Veena
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
Aug 2nd, 2007
0

Re: Excel in VB 6

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
Reputation Points: 10
Solved Threads: 3
Light Poster
guru511 is offline Offline
42 posts
since Jul 2007
Aug 2nd, 2007
0

Re: Excel in VB 6

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
Reputation Points: 10
Solved Threads: 3
Light Poster
guru511 is offline Offline
42 posts
since Jul 2007
Aug 2nd, 2007
0

Re: Excel in VB 6

Hi Guru,

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

Regards
Veena
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: can we create database through vb in sqlite
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: What are the following used for and how do you use them?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC