Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Interop Excel

Hi,

I have an Excel sheet that one of the workers has created and it must be
imported by column (number of columns varies). The pattern is simple, there
are groups of three columns repeated for each data header.

In one of the columns there is a value that looks like -9:49 (9 hours and
49 minutes ago). When I first save the xls as a csv, it puts an "=" (equal
sign) in front of the value and this value won't import. I tried to change
the column to be text only but this also is failing. I discovered I can go
in and open the csv in notepad and fix the screwed up values.

Then the import begins. I use VStudio to create an Excel Object (late
bound). All is well until for values like -9:30 and -9:00 but when it hits
the -9:49, the bound cell value returns -2146826273. I read something about
how the Excel.Application is now an Excel.Applicationclass.

I am running 2007 but have Office 97 loaded and can probably use this in an
emergency. I am not sure if it is the 2007 Excel object that is causing the
problem or if it is Visual Studio 2005.

Prior to getting the -2146826273, I received a Exception from HRESULT:
0x800A03EC. I was able to get around this by printing the cell value to
string before inserting it into the sql insert statement.

Please tell me there is an easier way?
--
Regards,
Jamie
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Interop Excel

I don't think that you can have negative times or dates. However, when I am
having problems importing csv files, I ensure that I have file extensions
enabled in Windows Explorer and change the file name to .txt; Then when you
import it you get full control over the Text To Columns.

If you do the above you might be able to set the column to text and then
handle the problem after it is imported. I would need to see a sample of the
data to suggest how you might handle it.

Don't know if you need the following but just in case:-
To turn on file extensions, Windows Vista:-
Open windows explorer
Select Organize-folder and search options-view tab and uncheck 'Hide
extensions for known file types'

Earlier versions of windows select Tools-Folder options and then as above.

--
Regards,

OssieMac


"thejamie" wrote:

Hi,

I have an Excel sheet that one of the workers has created and it must be
imported by column (number of columns varies). The pattern is simple, there
are groups of three columns repeated for each data header.

In one of the columns there is a value that looks like -9:49 (9 hours and
49 minutes ago). When I first save the xls as a csv, it puts an "=" (equal
sign) in front of the value and this value won't import. I tried to change
the column to be text only but this also is failing. I discovered I can go
in and open the csv in notepad and fix the screwed up values.

Then the import begins. I use VStudio to create an Excel Object (late
bound). All is well until for values like -9:30 and -9:00 but when it hits
the -9:49, the bound cell value returns -2146826273. I read something about
how the Excel.Application is now an Excel.Applicationclass.

I am running 2007 but have Office 97 loaded and can probably use this in an
emergency. I am not sure if it is the 2007 Excel object that is causing the
problem or if it is Visual Studio 2005.

Prior to getting the -2146826273, I received a Exception from HRESULT:
0x800A03EC. I was able to get around this by printing the cell value to
string before inserting it into the sql insert statement.

Please tell me there is an easier way?
--
Regards,
Jamie

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Interop Excel

That was easy. What was I thinking?
--
Regards,
Jamie


"OssieMac" wrote:

I don't think that you can have negative times or dates. However, when I am
having problems importing csv files, I ensure that I have file extensions
enabled in Windows Explorer and change the file name to .txt; Then when you
import it you get full control over the Text To Columns.

If you do the above you might be able to set the column to text and then
handle the problem after it is imported. I would need to see a sample of the
data to suggest how you might handle it.

Don't know if you need the following but just in case:-
To turn on file extensions, Windows Vista:-
Open windows explorer
Select Organize-folder and search options-view tab and uncheck 'Hide
extensions for known file types'

Earlier versions of windows select Tools-Folder options and then as above.

--
Regards,

OssieMac


"thejamie" wrote:

Hi,

I have an Excel sheet that one of the workers has created and it must be
imported by column (number of columns varies). The pattern is simple, there
are groups of three columns repeated for each data header.

In one of the columns there is a value that looks like -9:49 (9 hours and
49 minutes ago). When I first save the xls as a csv, it puts an "=" (equal
sign) in front of the value and this value won't import. I tried to change
the column to be text only but this also is failing. I discovered I can go
in and open the csv in notepad and fix the screwed up values.

Then the import begins. I use VStudio to create an Excel Object (late
bound). All is well until for values like -9:30 and -9:00 but when it hits
the -9:49, the bound cell value returns -2146826273. I read something about
how the Excel.Application is now an Excel.Applicationclass.

I am running 2007 but have Office 97 loaded and can probably use this in an
emergency. I am not sure if it is the 2007 Excel object that is causing the
problem or if it is Visual Studio 2005.

Prior to getting the -2146826273, I received a Exception from HRESULT:
0x800A03EC. I was able to get around this by printing the cell value to
string before inserting it into the sql insert statement.

Please tell me there is an easier way?
--
Regards,
Jamie

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Security Concerns using interop excel chriscap Excel Programming 2 December 20th 07 09:19 PM
Excel Interop DLL problem 2003 [email protected] Excel Programming 2 December 13th 07 04:26 PM
Interop.Excel Split and Copy krayakin Excel Programming 4 August 21st 07 09:16 PM
Excel interop from c# Velislav Excel Programming 3 February 15th 07 07:39 AM
Excel interop versions Maik Excel Programming 2 May 16th 05 09:32 PM


All times are GMT +1. The time now is 03:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"