?
Solved

Problems with opening Excel

Posted on 2004-08-31
8
Medium Priority
?
359 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

752 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