Solved

Problems with opening Excel

Posted on 2004-08-31
8
317 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
  • 4
  • 4
8 Comments
 
LVL 8

Expert Comment

by:wguerram
Comment Utility
What line of code correspond to the line

Form1.vb:line 203
0
 

Author Comment

by:Schuppex
Comment Utility
               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
Comment Utility
When you get the error what are the values of

intRow, intCols?
0
 

Author Comment

by:Schuppex
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 8

Expert Comment

by:wguerram
Comment Utility
Your friend is running the exe file?

or The source code?
0
 

Author Comment

by:Schuppex
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks! :)
You got the points
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now