Results 1 to 7 of 7

Thread: Program with Excel workbook

  1. #1

    Thread Starter
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 2006
    Location
    Corner of the Europe :)
    Posts
    1,959

    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

  2. #2
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    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

  3. #3

    Thread Starter
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 2006
    Location
    Corner of the Europe :)
    Posts
    1,959

    Re: Program with Excel workbook

    Thanks for the reply, but the problem isn't the version, it's the culture!

    Rate People That Helped You
    Mark Thread Resolved When Resolved

  4. #4
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,713

    Re: Program with Excel workbook

    Seems like MUI is the best option
    http://msdn.microsoft.com/en-us/libr...ffice.11).aspx

  5. #5

    Thread Starter
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 2006
    Location
    Corner of the Europe :)
    Posts
    1,959

    Re: Program with Excel workbook

    Thanks for the link but already read that...

    Rate People That Helped You
    Mark Thread Resolved When Resolved

  6. #6
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,713

    Re: Program with Excel workbook

    Quote Originally Posted by mickey_pt View Post
    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

  7. #7

    Thread Starter
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 2006
    Location
    Corner of the Europe :)
    Posts
    1,959

    Re: Program with Excel workbook

    Yes it's an option... in fact i wrote that, but i don't like that option, the need to install the MUI in all new computers, when updating the old ones to the new office, once again install the MUI... And they're a lot of computers

    So i'm trying to figure out one way to adapt my code to run without installing extra content to the users, the code that you wrote it's something that i'm reading right now... MSDN

    I need to make some tests to answer some questions before i look to reflection...

    Thank you

    Rate People That Helped You
    Mark Thread Resolved When Resolved

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
  •  



Click Here to Expand Forum to Full Width