Solved

Problems with opening Excel

Posted on 2004-08-31
8
355 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 500 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
VB.net Duplicating a table - primary key not created 3 43
Send SMS from vb.net desktop app 30 51
Web page design problem 3 41
Call a VB.net function in Javascript 6 51
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…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

732 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