Results 1 to 7 of 7

Thread: Run specific version of excel from VB.NET

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2021
    Posts
    6

    Run specific version of excel from VB.NET

    Hi,

    I have an application that starts excel and performs some operations on a number of workbooks.

    For performance and security reasons, this needs to be done in an older version, ie 2003.

    Now, the computer may also have office 365 installed.

    A few weeks ago, Microsoft updated 365 without my consent (needless to say I need to have all uppdates refused in order for this to work), which means that when calling the interoperability functions from VB, it starts the 365 version.

    So far, instead of using the createobject() method, I shell() the 2003 version and then use the getobject() method. However, this seems to start excel without elevated priviliges, meaning I cant get it via the getobject() method. It only works when Ive started excel manually prior to the code being executed.

    So here are my questions.

    Is there a way to change the registry so that it points to the 2003 version when using the interoperability functions?
    Is there a way to shell() excel with elevated priviliges?

    Thanks in advance

    /VB

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,155

    Re: Run specific version of excel from VB.NET

    Quote Originally Posted by Visual Bear View Post
    Hi,

    I have an application that starts excel and performs some operations on a number of workbooks.

    For performance and security reasons, this needs to be done in an older version, ie 2003.

    Now, the computer may also have office 365 installed.

    A few weeks ago, Microsoft updated 365 without my consent (needless to say I need to have all uppdates refused in order for this to work), which means that when calling the interoperability functions from VB, it starts the 365 version.

    So far, instead of using the createobject() method, I shell() the 2003 version and then use the getobject() method. However, this seems to start excel without elevated priviliges, meaning I cant get it via the getobject() method. It only works when Ive started excel manually prior to the code being executed.

    So here are my questions.

    Is there a way to change the registry so that it points to the 2003 version when using the interoperability functions?
    Is there a way to shell() excel with elevated priviliges?

    Thanks in advance

    /VB
    I did some searching, does this help https://stackoverflow.com/questions/...-administrator ?

  3. #3
    Member
    Join Date
    May 2012
    Location
    42.787034,-81.176367
    Posts
    43

    Re: Run specific version of excel from VB.NET

    This may or may not apply to Excel, but I have two different versions of Visual FoxPro installed.

    Each installed version of Visual FoxPro has its own ProgID.

    To use Visual FoxPro version 10, I do;
    Code:
    vfp = CreateObject("visualfoxpro.application")

    To use Visual FoxPro version 9, I do;
    Code:
    vfp = CreateObject("VisualFoxPro.Application.9")
    Joe
    Last edited by Joe Caverly; Mar 21st, 2021 at 07:05 AM.

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2021
    Posts
    6

    Re: Run specific version of excel from VB.NET

    Hi again and thanks for answering!

    This has turned out to be a bit of a problem. I followed the links and did some searching.

    Combining and trying a few different things, I got it working. I think (although Im not sure, and I wont try anything else for a while ) I did this:

    1. Run Visual studio, the working 2003 excel and the faulty excel whatever in administrator mode (this way I don't need to click the UAC in runtime, only when starting VS)
    2. Did a stupid work around due to the fact that excel apparantly does not register properly in the system before loosing focus (for this, I use a really primitive method).

    So as you probably realize, this is only temporary.

    So I really need the registry solution:

    Is there a way to change the registry so that it points to the 2003 version when using the interoperability functions?

    Thanks!

  5. #5
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    2,761

    Re: Run specific version of excel from VB.NET

    Quote Originally Posted by Visual Bear View Post
    Hi,

    I have an application that starts excel and performs some operations on a number of workbooks.

    For performance and security reasons, this needs to be done in an older version, ie 2003.
    what operations do you perform
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  6. #6

    Thread Starter
    New Member
    Join Date
    Mar 2021
    Posts
    6

    Re: Run specific version of excel from VB.NET

    Hi,

    I export a .txt file from sql server and open it in excel. Excel then opens a few workbooks with links to the .txt workbook.

    The workbooks have several calculated columns but above all they contain graphs, that are exported as .png pictures and imported back to pictureboxes in the vb program.

    After this all workbooks are closed and excel quits.

    Excel 2003 performs these operation on 1/5 of the time Excel 365 does it, and it is not subject to updates that effect the apearance of the graphs (ie thickness of lines, fonts in legends etc)

    thanks /vb

  7. #7
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    2,761

    Re: Run specific version of excel from VB.NET

    I don't know if Powershell is an option for you
    https://www.sqlshack.com/create-char...ng-powershell/
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

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