May 25th, 2006, 12:28 AM
#1
Thread Starter
Fanatic Member
Excel reader
Is there a way I can get some ExcelReader class? I don't want to use ADO.NET. Thanks in advance!
May 25th, 2006, 12:32 AM
#2
Re: Excel reader
Unless you want to read an XLS file in binary form and decipher it you'll either have to use Office Automation or ADO.NET.
May 25th, 2006, 12:42 AM
#3
Re: Excel reader
There is an Excel Viewer Utility but just for viewing the xls file without having to have Excel installed.
If thats not acceptable then automate Excel. What do you want to do with it?
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
May 25th, 2006, 01:44 AM
#4
Thread Starter
Fanatic Member
Re: Excel reader
I really love to see something like:
Code:
public void Test3()
{
ExcelReader e = new ExcelReader( "Some.xls" );
e. WorkSheet = "WorksheetName" ;
ExcelRow r = e. First();
while ( r != null )
{
Console. WriteLine( r[ "A" ]. ToString());
Console. WriteLine( r[ "B" ]. ToString());
Console. WriteLine( r[ "C" ]. ToString());
r. Next();
}
}
May 25th, 2006, 02:53 AM
#5
Re: Excel reader
Fine!
Got tired of formatting the code to look nice so I just attached it for you.
It creates an Excel.Application object and on the form it has a browse button to open a workbook. Then the left button will write a value to cell A1 and save the workbook. Then when you close the form, Excel closes properly.
Whew!!!
Ps, sorry about naming the buttons with relevant names and stuff.
Edit: 28,000 POSTS! Meow!
Attached Files
Last edited by RobDog888; May 25th, 2006 at 03:13 AM .
Reason: updated attachment
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
May 25th, 2006, 03:02 AM
#6
Thread Starter
Fanatic Member
Re: Excel reader
Hehehe. Ok thanks but I know a little about this stuff. Anyway, I just create my ExcelReader class encapsulating the ones you posted plus Iterator. Thanks again!
May 25th, 2006, 03:11 AM
#7
Re: Excel reader
Np, I just noticed I forgot to change a line of code to open the workbook in the textbox instead of my test hard coded file.
VB Code:
Excel.Workbook oWB = (Excel.Workbook)moApp.Workbooks.Open([b]@textBox1.Text[/b],objMissing,objMissing,...
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
Mar 15th, 2007, 09:21 PM
#8
Hyperactive Member
Re: Excel reader
hi RobDog888. I have to create a program to do some excel manipulation and your program helped me a lot that you attached.
However there's 2 lines in your code:
using Excel = Microsoft.Office.Interop.Excel;
///Add a reference to MS Excel xx.0 Object Library
Where could I get this reference / Dll? I hope this is not a silly question, if it was forgive me, its the first tiem I'm doing this.
This is since i'm getting the error that :
The type or namespace name 'Interop' does not exist in the class or namespace 'Microsoft.Office' (are you missing an assembly reference?)
Jennifer.
Mar 15th, 2007, 09:37 PM
#9
Re: Excel reader
Originally Posted by
JenniferBabe
hi RobDog888. I have to create a program to do some excel manipulation and your program helped me a lot that you attached.
However there's 2 lines in your code:
using Excel = Microsoft.Office.Interop.Excel;
///Add a reference to MS Excel xx.0 Object Library
Where could I get this reference / Dll? I hope this is not a silly question, if it was forgive me, its the first tiem I'm doing this.
This is since i'm getting the error that :
The type or namespace name 'Interop' does not exist in the class or namespace 'Microsoft.Office' (are you missing an assembly reference?)
Jennifer.
You add a reference to the appropriate Office application's object library from the COM tab.
Mar 16th, 2007, 08:57 AM
#10
Hyperactive Member
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