another option:
canb it be that the actual sheet2 is hidden? you might check this by unhiding all sheets: Format>>sheets>>unhide
Main Topics
Browse All Topicsthe following code runs on my pc and 3 other pcs
Dim xlApp as Excel.Application
Set xlApp = CreateObject("Excel.Applic
Dim xlwb As Workbook
Dim XLSheet As Worksheet
Set xlwb = xlApp.Workbooks.Open(txtFi
while it crashes from the EXE on the last line on 3 different pcs (not the ones mentioned above)
txtfile.text is a valid file path
but the following code runs on the same pc
Dim xlApp
Set xlApp = CreateObject("Excel.Applic
Dim xlwb
Dim XLSheet
Set xlwb = xlApp.Workbooks.Open(txtFi
Can anyone explain me why?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
have just a final suggestion which is based on info in next atricle:
http://support.microsoft.c
Can it be that there are restriction on user level concerning the registry usage?
Is there some reason why you want to use early binding (Dim xlApp as Excel.Application) and not using late binding: (Dim xlApp as Object) using latebinding won't use the reference file.
In you second example it seems excel is setting it automatically to late binding.
Although on this level early binding should not be a problem. It might be so that the user which use the example with early binding doesn't have that much rights to change the registry. using references will change the registry settings for excel. if the file is created with an newer or older version of the object library of excel and there is no right to the registry then excel might crash/return errors).
I hope this explains it a bit for you.
regards,
Jeroen
All the users have rights to change the registry,
the version of excel is the same on all the pcs
I have already deployed the application with late binding, this question is just to try to get an explaination as it puzzles me.
only diff where it works and doesnt work is where it works has either .net studio or visual studio. where it doesnt work doesnt have any.
Hi bhagyesht,
your explantation of the situation is very good to see which circumstances there are. the only thing I can think about is that the pc's where it works have there own debugger (from .net an visual studio) and therefor it won't crash (although it should not crash at all). I saw something likely with lotus notes. has also its own debuger. This didn't made some applciations crash and run correctly. you might check in the registry under controll set>debugger (somthing)
I can imagine that the reason why it crashes is that the combination:
Dim xlApp as Excel.Application
Set xlApp = CreateObject("Excel.Applic
is of type early binding.
what is the value of: txtFile.Text can it be that there is some space in it? or is it used to open all files?
I don't have a clue where to look at now and you made me also very curious about the solution.
regards,
Jeroen
Maybe your prog crashes somewhere earlier and this is the first point where you notice it, so it could be like:
1. your app uses other libraries, too (at least some Visual Basic runtimes, eg. MSVBVM60.dll)
2. Office was installed before .net studio
3. while installing .net studio some libraries were updated without notification
4. now your program starts, and one of those libraries already produces an error while loading it
5. I've seen the effect that libraries that your prog wanted to load after the critical lib aren't loaded at all (in one case I could not even use basic string functionality ;-( )
6. so the Excel lib is not loaded properly
7. if you use late binding, that does not matter, but with early binding, you have a problem now
Remember, this is just a theory. So solve this one, you should check ALL libraries your programm uses, not just whether they are there but whether they have the same version.
Greets
Steiner
Oh, and check the paths leading to the libraries, too. Sometimes one lib is installed more than once and you'll have difficulties on finding which one is currently in use. For example a reference to "Visual Basic for Applications" might lead to:
VBAEN32.olb
VEN2232.olb
VBAEND32.olb
MSVBVM60.dll
MSVBVM50.dll
and 2 other files under Microsoft Sharec file where the full path does not fit into the dialog...
Hi roos01,
1. All VB programs use VB runtime.
2. where it crashes as mentioned in the earlier post doesnt have studio.
3. void due to 2
4. Didnt quite understand this
5. Na I hit a msgbox after every load to find out where it crashed it crashed at Excel.workbook
6. Excel.application starts hence ruled out
7. great! I am now aware that I have a problem. I already knew that there is a problem difficult part is knowing why its there.
Regards,
Bhagyesh
Business Accounts
Answer for Membership
by: roos01Posted on 2004-04-20 at 04:06:44ID: 10867653
Does all PC's contain the same excel version. Newer version supporting both (late as early binding) and older only early bindings. AQs/InterD ev/ Earlyvs LateBindin g.htm
http://www.mvps.org/word/F
perhaps this give an aplaination.
regards,
Jeroen