TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
richard smith
1.5k
285
160.3k
Weird Debug Error
Mar 2 2013 11:50 AM
I keep getting a NullReferenceException was unhandled error in my code. The strange thing to me, is I am checking if the actual workbook name exists before I attempt to open it, and it passes the check of ifexists (as well as I have navigated to the location and physically checked it and opened it) Below is my code, can someone see what is throwing the error?
What's even more peculiar to me is I run the same line of code in a different location and it passes through the code like a hot knife on butter!?!?!?!
//Declaring Variables
Excel._Workbook oWB;
Excel.Application oXL;
//Checking if file exists
if (File.Exists(filePath + workbookName + ".xls")) //code makes it through here FINE!!!!
oWB.oXL.Workbooks.Open(filePath + workbookName + ".xls"); //This line throws the reference exception.
{
//run code once workbook is open
}
Reply
Answers (
1
)
Disable navigation in windows picture and fax viewer VB.Net
Problem Reading Data