?
Solved

How to resolve the Excel error in my user's machine

Posted on 2005-04-18
10
Medium Priority
?
433 Views
Last Modified: 2012-06-27
I wrote a programme and I get this error at the following code

ERROR: Exception from HRESULT: 0X800A03EC

I get the above error only on the user machine but not on my machine when I pass the data value to the excel object like this:


Dim objX1 As Excel.Application
        Dim objXbook1 As Excel.Workbook
        Dim objXwith1 As Excel.Worksheet
 strdates = DateAdd(DateInterval.Day, -1, DATES)
                objXwith1.Cells._Default(i + 2, 31) = strdates.ToString("yyyy/MM/dd")

My excel template date column is of custom type and in the format
"yyyy/MM/dd".  Why I get the above error when I pass the date as string to the excel and IT HAPPENS ONLY ON ONE OF THE USERS MACHINE BUT WORKS FINE ON MY WORKSTATION.
ANY CLUE.
Thanks
VM
0
Comment
Question by:vmandem
  • 6
  • 4
10 Comments
 
LVL 2

Expert Comment

by:mjwills
ID: 13821807
Dim objX1 As Excel.Application
Dim objXbook1 As Excel.Workbook
Dim objXwith1 As Excel.Worksheet
strdates = DateAdd(DateInterval.Day, -1, DATES)
objXwith1.Cells._Default(i + 2, 31) = strdates.ToString("yyyy/MM/dd")

a) Show us your declaration of DATES, i and strdates.
b) Show us your assignment of DATES and i.
c) Does the code work if you change strdates.ToString("yyyy/MM/dd") to CDate(strdates)?
0
 

Author Comment

by:vmandem
ID: 13824571
I declared them as follows:

Dim strdates as date
dim i as integer

'I'm getting number of rows into an integer
  NumRows = UBound(varRolledUp, 2)

'My loop starts here
for i = o to numrows
DATES = varRolledUp(30, i)
 strdates = DateAdd(DateInterval.Day, -1, DATESTART)
'THE ERROR POPS UP ON USER MACHINE IN THE BELOW CODE
objXwith1.Cells._Default(i + 2, 6) = strdtstart.ToString("yyyy/MM/dd")
next

I HAVE NOT TRIED YOUR C OPTION. I CAN TRY AND LET YOU KNOW. DO YOU SUGGEST CHANGING THE FORMAT OF THE DATE COLUMN IN THE TEMPLATE TO SOMETHING ELSE INSTEAD OF CUSTOM TYPE "(yyyy/MM/dd)"

Thanks
vm
0
 

Author Comment

by:vmandem
ID: 13824581
Sorry I mentioned strdtstart at
objXwith1.Cells._Default(i + 2, 6) = strdtstart.ToString("yyyy/MM/dd")  

but it is strdates.ToString
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:vmandem
ID: 13827128
Any thoughts mjwills
0
 
LVL 2

Expert Comment

by:mjwills
ID: 13830515
a) The code has changed substantially between posting. Can you post the current code? Don't retype it - cut and paste it. I am particularly concerned by the changes of variable names (DATES -> DATESTART, strdates -> strdtstart etc).

b) Show us your declaration of DATES, DATESTART, NumRows and strdtstart . If you change any variable names or add any new variables, show me their declarations too.

c) Show us your assignment of DATESTART and strdtstart. If you change any variable names or add any new variables, show me their assignments too.

d) Does the code work if you change variablename.ToString("yyyy/MM/dd") to CDate(variablename)?

e) Also, can you confirm whether you have the lines:

Option Explicit On
Option Strict On

at the top of your file? You MUST have at least the first one.

f)  HAVE NOT TRIED YOUR C OPTION. I CAN TRY AND LET YOU KNOW. DO YOU SUGGEST CHANGING THE FORMAT OF THE DATE COLUMN IN THE TEMPLATE TO SOMETHING ELSE INSTEAD OF CUSTOM TYPE "(yyyy/MM/dd)"

See my c) suggestion, and try it out. Don't fiddle with other stuff - just make the requested change. The formatting of the date column in the Excel spreadsheet is irrelevant (trust me on this).
0
 
LVL 2

Accepted Solution

by:
mjwills earned 135 total points
ID: 13830518
<quote>
See my c) suggestion, and try it out. Don't fiddle with other stuff - just make the requested change. The formatting of the date column in the Excel spreadsheet is irrelevant (trust me on this).
</quote>

should be:

<correction>
See my d) suggestion, and try it out. Don't fiddle with other stuff - just make the requested change. The formatting of the date column in the Excel spreadsheet is irrelevant (trust me on this).
</correction>
0
 

Author Comment

by:vmandem
ID: 13837063
mjwills

First of all the d) suggestion did not work on her workstaion and it gives the same error. Here is the current code I have it right now.

 Dim objX1 As Excel.Application
 Dim objXbook1 As Excel.Workbook
 Dim objXwith1 As Excel.Worksheet
Dim DATESTART As Date
objX1 = New Excel.Application

 objX1.Workbooks.Add(Application.StartupPath & "\Test.xlt")
            objXbook1 = objX1.Workbooks(objX1.Workbooks.Count)
            objX1.Visible = False
            objX1.ScreenUpdating = False
              ' Format and populate sheet
            objXwith1 = objXbook1.Worksheets(1)
DATESTART = varRolledUp(5, i)
 objXwith1.Cells._Default(i + 2, 6) = DateAdd(DateInterval.Day, -1, DATESTART)

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

I CHANGED THE ABOVE LINE WITH YOUR OPTIONS LIKE CHANGING TO CDATE BUT THAT DID NOT WORKDED.
I HAVE NOT MADE ANY CHANGES TO THE TEMPLATE THOUGH AS YOU SUGGESTED AND IT REMAINS IN THE FORMAT AS CUSTOM(yyyy/mm/dd)
0
 

Author Comment

by:vmandem
ID: 13861069
mjwills no response from you on this, any thoughts about this.
0
 
LVL 2

Expert Comment

by:mjwills
ID: 13864997
You haven't answered *all* my questions (a - f). When you do, I'll respond.
0
 

Author Comment

by:vmandem
ID: 13870633
o.k. I will do that
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question