Help: Using MS-Excel properties in VB.Net

utd_anurag

New member
Joined
Jan 9, 2006
Messages
2
Programming Experience
Beginner
Hello Friends,

I am trying to import Microsoft Excel file using VB.net.

I started working on VB.net since a few months back.

I have a file which has information in date & time format.

If you would look at a Date record in an Excel file. If you edit the property of that box:

Right Click -> ; Format Cells.. ->; General ->; <OK>

you would get result in an integer format.

Ex.

12/22/2005.
Do the above mentioned things & you will get:
38708


I am curious how to do the above-mentioned things, if I want to control this property in the VB.net using programming.

If you could provide me some information/tutorial, that would be of great help.

I need this information badly.

Thanks,
Anurag
 
A "starter" article:
http://www.visualbasicforum.com/showthread.php?t=160433

MSDN VBA references both for download and online:
http://msdn.microsoft.com/office/downloads/vba/default.aspx

The predefined formatting you refer to is set with a excel.workbook.range.style property, there are also many other properties to format a range.
VB.NET:
ExcelApp.Worksheets("Sheet1").Range("A1:A10").Style = "Percent"

MSDN Style object http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaxl11/html/xlobjStyle1_HV05205383.asp

MSDN Styles collection http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaxl11/html/xlobjStyles1_HV05205393.asp

VB.Net Office Automation FAQ: http://www.visualbasicforum.com/showthread.php?t=160459
 
Back
Top