Results 1 to 3 of 3

Thread: Running Excel Through AxWebBrowser

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    12

    Running Excel Through AxWebBrowser

    Hi All,

    I am extremely new to VB. I am creating an app that manages individual excel lists and compiles them into a larger global list. When one individual list is closed it opens the global list and updates it via VBA, then closes both. I had it all working fine in VBA. Then my boss asked me to integrate it all into a standalone app. I read somewhere that you can use an active X browser to open the excel files inside VB forms. It worked beautifully with all of the macros until I try to close the file and update the global list. I get an error at the open command in the VBA macro. I am assuming it has something to do with the browser because I can still open the inidivual list from excel and have it update the global list.

    hope this was coherent....

    thoughts?

    thanks in advance

  2. #2

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    12

    Re: Running Excel Through AxWebBrowser

    so after much fiddling i believe i solved my own problem. I had to convert the VBA macro into VB code but that was not too hard given i could import the microcoft excel namespace.

    I created a second AxWebBrowser and navigated it to the global list I want to update. I then dimension a New Excel.Application as xl,

    Dim xl as excel.application

    well as two excel.workbooks, wb1 and wb2. I then assign wb1 = xl.Workbooks(1) and wb2 = xl.Workbooks(2)

    Dim wb1 as excel.workbook
    Dim wb2 as excel.workbook


    wb1 = xl.Workbooks(1)
    wb2 = xl.Workbooks(2)

    then i can run my macro which is now VB code

    Hope that helped someone

  3. #3
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Re: Running Excel Through AxWebBrowser

    Hi Kwints, and welcome to the forums!

    Though a little late, you can automate any of the Microsoft Office applications by using either late binding (and the CreateObject keyword) to allow you to code against multiple versions of the Office application, or early binding (where you add a reference to the relevant Office library and code against a specific version of an Office application, but gain both performance costs at runtime, as well as being able to have intellisense support whilst developing).

    As you mentioned, you can use version 6, or you can use any of the .Net versions of VB in order to accomplish this automation and you might find the tutorials on automation on this thread useful for whichever version you use.

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

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