|
-
Sep 21st, 2007, 07:19 AM
#1
Thread Starter
Junior Member
[RESOLVED] What is Runtime Error 400?
Everytime I try and run a program on my work computer, that works
fine on my laptop, it crashes. I keep getting a box that comes up
with a red circle and white "X" in the middle with "400" in the form. All
I can click is OK and it closes my program. Does anyone know what this
means? I tried searching and couldnt find anything. I just dont
understand why it would work fine on one and not on another.
Quick Program Description --> Open Excel(Using Late Bindings vice the
Excel library) and copies data into an array. Afterward, displaying a form
where you can flip between different array data.
Any help on this would be great. Thanks for all replies in advance.
Joshua
-
Sep 21st, 2007, 07:24 AM
#2
Re: What is Runtime Error 400?
Can you run the program from source on your laptop?
-
Sep 21st, 2007, 07:29 AM
#3
Thread Starter
Junior Member
Re: What is Runtime Error 400?
No, I cannot run from VB6 due to the fact that the Excel file that
I am opening will be contained in the same folder as the app. Just a
sec. OK, I copied my excel file to my VB6 folder and yes it runs fine
from the the source code.
-
Sep 21st, 2007, 07:34 AM
#4
Re: What is Runtime Error 400?
Well, according to Google, runtime 400 means "Form already displayed; can't show modally" so it would seem like an attempt is being made to show a form that is already visible.
Have you tried this program on other desktops?
-
Sep 21st, 2007, 07:39 AM
#5
Thread Starter
Junior Member
Re: What is Runtime Error 400?
Yes, I tried on my home PC and everything worked fine also. I am stumped
right now. I am going to add in some MsgBoxes and see how far I actually
get before it freezes on my work PC. It might not even make it past Excel
loading up before the Main Form is shown. Give me a couple of minutes and
I will reply with my findings.
-
Sep 21st, 2007, 07:40 AM
#6
Re: What is Runtime Error 400?
So, it would appear that it works fine on desktops, but just not on your laptop.
To me this does not indicate a problem with your code. It would indicate an issue with your laptop.
Have you tried installing on a different laptop?
-
Sep 21st, 2007, 07:46 AM
#7
Re: What is Runtime Error 400?
Hi Hack,
Take another look at post #1, I read it as he has no problems with his laptop, just his work PC.
-
Sep 21st, 2007, 07:59 AM
#8
Thread Starter
Junior Member
Re: What is Runtime Error 400?
Ok, through some MsgBoxes in there and the error is coming up somewhere
in the following 4 lines of code.
xlApp.Visible = False
Set xlBook = xlApp.Workbooks.Open(pather & "\test.xls")
Set xlSheet = xlBook.Worksheets("CE")
lastrow = xlSheet.UsedRange.Rows.Count
-
Sep 21st, 2007, 08:03 AM
#9
Re: What is Runtime Error 400?
 Originally Posted by Steve Grant
Take another look at post #1, I read it as he has no problems with his laptop, just his work PC. 
I read this just the opposite
 Originally Posted by Joshua Z
Everytime I try and run a program on my work computer, that works fine on my laptop, it crashes.
That it works on his desktop but not his laptop.
-
Sep 21st, 2007, 08:45 AM
#10
Thread Starter
Junior Member
Re: What is Runtime Error 400?
OK, below is the line that is throwing the error. Does anyone see anything
wrong with it? Keep in mind that I am not including the Execl Library.(Dont
know if this makes a diff.)
Set xlBook = xlApp.Workbooks.Open(pather & "\test.xls")
-
Sep 21st, 2007, 08:54 AM
#11
Re: What is Runtime Error 400?
You are setting a reference to it, right?
Also, when you run it on a different computer, you have done a formal installation, right? Not just a file copy.
-
Sep 21st, 2007, 09:21 AM
#12
Thread Starter
Junior Member
Re: What is Runtime Error 400?
Code for the sub is as follows.
Dim xlApp as Object
Dim xlBook as Object
Dim xlSheet as Object
Dim loop1 as Integer
Dim loop2 as Integer
Dim lastrow as Integer
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = False
Set xlBook = xlApp.Workbooks.Open(pather & "\test.xls")
Set xlSheet = xlBook.Worksheets("CE")
lastrow = xlSheet.UsedRange.Rows.Count
For loop1 = 1 to lastrow
For loop2 = 1 to 12
ce_array(loop1,loop2) = xlSheet.Cells(loop1,loop2)
Next loop2
Next loop1
Set xlSheet = Nothing
xlBook.Close
Set xlBook = Nothing
xlApp.Quit
Set xlApp = Nothing
-
Sep 21st, 2007, 10:20 AM
#13
Thread Starter
Junior Member
Re: What is Runtime Error 400?
-
Sep 21st, 2007, 10:22 AM
#14
Re: What is Runtime Error 400?
No, nothing looks off.
But, back to my old question, you did install it rather than copy it, right?
-
Sep 21st, 2007, 11:15 AM
#15
Thread Starter
Junior Member
Re: What is Runtime Error 400?
Everything is installed, not copied. This has got me stumped.
-
Sep 21st, 2007, 05:25 PM
#16
Thread Starter
Junior Member
Re: What is Runtime Error 400?
OK, I got fixed it. For some reason it wanted
Set xlBook = xlApp.Workbooks.Open(FileName := pather & "\test.xls")
vice
Set xlBook = xlApp.Workbooks.Open(pather & "\test.xls").
Dont know why it would be picky on 1 PC and not another. Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|