|
-
May 3rd, 2002, 10:20 PM
#1
Thread Starter
Member
excel spreadsheet tranferred to a data grid
I need help with code to import a specific sheet into a datagrid. The .xls file is at C:\test.xls. But only need to pull "sheet1" to the grid. I know this is probably a simple task but Im new and stuck here. Thanx for help!!!
Brian
-
May 4th, 2002, 02:40 PM
#2
Thread Starter
Member
-
Jan 7th, 2006, 11:45 PM
#3
New Member
Re: excel spreadsheet tranferred to a data grid
-
Jan 8th, 2006, 12:27 AM
#4
Re: excel spreadsheet tranferred to a data grid
Welcome to the forums. 
Have you tried searching yet? I have many many code examples with Excel. Try a search for Excel and posts by me.
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 
-
Jan 8th, 2006, 12:34 AM
#5
Re: excel spreadsheet tranferred to a data grid
Seeing how its slow tonight I will write something for you.
VB Code:
Option explicit
'Add a reference to ms excel xx.0 object library
Private sub command1_click()
dim oApp as excel.application
dim oWB as excel.workbook
set oapp = new excel.application
set owb = oapp.workbooks.open("C:\MyFile.xls")
'instead of a msgbox place looping code to iterate
'through your cell range of data to be entered into your grid.
Msgbox owb.sheets("Sheet1").Cells(1, 1)
owb.close
set owb = nothing
oapp.quit
set oapp = nothing
End sub
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 
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
|