|
-
Feb 21st, 2011, 04:57 AM
#1
Thread Starter
Frenzied Member
Program with Excel workbook
Hello
I have a little problem with a small application that uses an excel workbook, and i don't know what's the best way to handle this.
In the past every computers here in the company had the same culture and the same office version/language.
Now the company bought some new machines, that came with english version of the office (en-US). Now the program doesn't work, throwing the exception related with the assembly of the office.
I have two solutions to solve this, install the mui in all the computers, or the one that i want, adapt the application to work independent of the culture in the client machine.
So how to accomplish this? Set the application culture to the same culture in the computer (i think this will not work, because the excel assembly that i ship with the application isn't the correct one for the client language it's the assembly of my machine language)... One copy for each language, once again it's not possible...
Thanks
Rate People That Helped You
Mark Thread Resolved When Resolved
-
Feb 21st, 2011, 05:22 AM
#2
Re: Program with Excel workbook
Maybe with late binding and version checking. Here's a link to find what version is being used.
http://www.vbforums.com/showthread.php?t=402020
This may be relevant:
http://social.msdn.microsoft.com/For...6-62de43e7b238
-
Feb 21st, 2011, 05:49 AM
#3
Thread Starter
Frenzied Member
-
Feb 21st, 2011, 06:59 AM
#4
Re: Program with Excel workbook
-
Feb 21st, 2011, 07:06 AM
#5
Thread Starter
Frenzied Member
-
Feb 21st, 2011, 07:11 AM
#6
Re: Program with Excel workbook
 Originally Posted by mickey_pt
Thanks for the link but already read that... 
So that is not an option?
How about http://www.dotnetmonster.com/Uwe/For...glish-Standard
Bypassing PIAs
Code:
Try
Dim objXlType As Type
Dim objXlObj As Object
Dim objXlWbks As Object
Dim objXlNewWbk As Object
objXlType = Type.GetTypeFromProgID("Excel.Application")
objXlObj = Activator.CreateInstance(objXlType)
objXlWbks = objXlObj.GetType.InvokeMember("Workbooks", _
System.Reflection.BindingFlags.GetProperty, _
Nothing, objXlObj, Nothing, _
New System.Globalization.CultureInfo(1033))
objXlNewWbk = objXlWbks.GetType.InvokeMember("Add", _
System.Reflection.BindingFlags.InvokeMethod, _
Nothing, objXlWbks, Nothing, _
New System.Globalization.CultureInfo(1033))
Dim visibool(0) As Object
visibool(0) = True
objXlObj.GetType.InvokeMember("Visible", _
System.Reflection.BindingFlags.SetProperty, _
Nothing, objXlObj, visibool, _
New System.Globalization.CultureInfo(1033))
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
You need to edit the culture
-
Feb 21st, 2011, 07:21 AM
#7
Thread Starter
Frenzied Member
Tags for this Thread
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
|