|
-
Feb 9th, 2006, 03:17 PM
#1
Thread Starter
Hyperactive Member
How do I display an Excel sheet?
Ok, I've scoured the forums and can't find an (easy ) answer to this. Someones got to walk me through now.
I want my users to select an excel file and then have it load the worksheet (display it) into a table. I don't care if the table is directly editable or if it launches Excel to edit it, but I need to be able reference the cells in the table.
Thanks.
Last edited by Datacide; Feb 10th, 2006 at 01:16 PM.
PHP in your FACE!
-
Feb 9th, 2006, 03:20 PM
#2
Re: Excel Question
 Originally Posted by Datacide
I want my users to select an excel file and then have it load the worksheet (display it) into a table.
Into what type of a table? Can you give some more info?
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Feb 9th, 2006, 03:22 PM
#3
Re: Excel Question
Do you mean like a VB6 FlexGrid thats related to your selected Excel file?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 9th, 2006, 03:24 PM
#4
Thread Starter
Hyperactive Member
Re: Excel Question
Ya either a FlexGrid thingy or an Excel OLE, or whatever would be best.
-
Feb 9th, 2006, 03:25 PM
#5
Re: Excel Question
well here's one way... add a reference to "Microsoft Excel X.X Object library", and use code like this:
VB Code:
'** Declarations section
Dim oXLApp as Excel.Application 'Declare the object variables
Dim oXLBook as Excel.Workbook
Dim oXLSheet as Excel.Worksheet
'** To open the file:
Set oXLApp = New Excel.Application 'Create a new instance of Excel
Set oXLBook = oXLApp.Workbooks.Open("C:\folder\file.xls") 'Open your workbook
Set oXLSheet = oXLBook.Worksheets(1) 'Work with the first worksheet
oXLApp.Visible = True
'** To work with the data:
With oXLSheet 'Find the row to write to
MsgBox .Cells(2, 1) '(A2)
.Cells(1, 2) = Text2.Text '(B1)
End With
'** To save the file:
Set oXLSheet = Nothing 'disconnect from the Worksheet
oXLBook.Close SaveChanges:= True 'Save (and disconnect from) the Workbook
Set oXLBook = Nothing
oXLApp.Quit 'Close (and disconnect from) Excel
Set oXLApp = Nothing
-
Feb 9th, 2006, 03:27 PM
#6
Thread Starter
Hyperactive Member
Re: Excel Question
But will that display the spread sheet? That's what I reall need.
-
Feb 9th, 2006, 03:27 PM
#7
Re: Excel Question
If you need to reference the cells in the table are you refering to the VB6 Grid side or Excels Cells? If Excel then your better off using the Excel Object Model in VB6. If you use the OLDE Control then you cant reference the Cells in VB6 without re-opening the file using the EOM. so not much point. See, better just using EOM to load your Grid.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 10th, 2006, 01:15 PM
#8
Thread Starter
Hyperactive Member
How do I display an Excel sheet?
Ok, if I place the Microsoft Excel Workheet control thingy on my form, who do I change which file it displays and how would I get the data from the cells?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|