Solved

Problems with opening Excel

Posted on 2004-08-31
8
352 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

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Complex SQL statement in VB.NET 7 39
VB.Net. Reading xml value 6 38
How to share My.Settings in multiple application instances ? 7 51
Need help with another query 10 37
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…
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
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…

756 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