[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Problems with opening Excel

Posted on 2004-08-31
8
Medium Priority
?
362 Views
Last Modified: 2006-11-17
Hello,

I made a little program on my pc ( Windows XP pro + Excel 2000). It calculates some numbers and try's to put them into an excel worksheet.
On my PC I had no problems.

But a friend of mine ( Windows XP Home Edition + Excel XP) had some problems when the program tried to open excel. I managed to find a solution (It had to do with the regional settings). But now it still gives an error.


************** Exception Text **************
System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC.
   at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateSet(Object o, Type& objType, String name, Object[] args, String[] paramnames, Boolean OptimisticSet, CallType UseCallType)
   at Microsoft.VisualBasic.CompilerServices.LateBinding.LateSetComplex(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean OptimisticSet, Boolean RValueBase)
   at Poef.Form1.mnuExcelZet_Click(Object sender, EventArgs e) in C:\Documents and Settings\bla\Mijn documenten\Visual Studio Projects\Poef\Form1.vb:line 203
   at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.MenuItemData.Execute()
   at System.Windows.Forms.Command.Invoke()
   at System.Windows.Forms.Control.WmCommand(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


The Code:

       Dim xlApp As Excel.Application
        Dim xlWB1 As Excel.Workbook
        Dim xls As Excel.Worksheet
        Dim intRow, intCols, inti, intdummy As Integer
        Dim labelDummy1 As Label

        intdummy = 0
        xlApp = New Excel.Application
        xlApp.Visible = True
        xlApp.UserControl = True
        Dim oldCI As System.Globalization.CultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture
        System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US")
        xlWB1 = xlApp.Workbooks.Add
        System.Threading.Thread.CurrentThread.CurrentCulture = oldCI
        xls = xlWB1.Sheets(1)


Can someone please help?
0
Comment
Question by:Schuppex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 8

Expert Comment

by:wguerram
ID: 11944051
What line of code correspond to the line

Form1.vb:line 203
0
 

Author Comment

by:Schuppex
ID: 11944146
               Select Case intdummy
                    Case 0
                        xls.Cells(intRow, intCols).Interior.ColorIndex = 16
                        xls.Cells(intRow, intCols).Font.Bold = True
                    Case 1
                        xls.Cells(intRow, intCols).Interior.ColorIndex = 36
                    Case 2
                        xls.Cells(intRow, intCols).Interior.ColorIndex = 15
                End Select

line 203 = Case 0
0
 
LVL 8

Expert Comment

by:wguerram
ID: 11944338
When you get the error what are the values of

intRow, intCols?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Schuppex
ID: 11944372
I don't know, It's on my friends computer.
But I'm sure it can't have anything to do with the programming, because it works on my pc.
It should have something to do with the opening of excel or the XP Home edition.
0
 
LVL 8

Expert Comment

by:wguerram
ID: 11944382
Your friend is running the exe file?

or The source code?
0
 

Author Comment

by:Schuppex
ID: 11944427
the exe file with the dll's and stuff.
Just everything which is in the Bin folder.
0
 
LVL 8

Accepted Solution

by:
wguerram earned 2000 total points
ID: 11944520
Try removing the references to Excel in your app and instead of

declaring the variables

        Dim xlApp As Excel.Application
        Dim xlWB1 As Excel.Workbook
        Dim xls As Excel.Worksheet

Declare them like this

        Dim xlApp As Object
        Dim xlWB1 As Object
        Dim xls As Object

and
instead of  
xlApp = New Excel.Application
Create the excel instance like this
xlApp = CreateObject("Excel.Application")

This way you won't have intellisense but probably you are having problems because of the references to versions of office.
0
 

Author Comment

by:Schuppex
ID: 11944798
Thanks! :)
You got the points
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

649 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