Results 1 to 9 of 9

Thread: Help Please Quick Soon Please, I Have A Big Problem

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2001
    Posts
    364

    Exclamation Help Please Quick Soon Please, I Have A Big Problem

    please help I need to inset an excel workbook / sheet into vb and i need to be able to edit it in vb. And be able to run it in vb eg i can click on the macro buttons in excel
    please help soon
    thanks

  2. #2
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    You just want to run the excel macro?

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Embed an Excel OLE Object on your VB Form.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2001
    Posts
    364
    i have put an excel ole object but i can click on the buttons in our excel sheet !!!

  5. #5
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    VB Code:
    1. Dim xlApp As New Excel.Application
    2. Dim xlWb As Excel.Workbook
    3. Set xlWb = xlApp.Workbooks.Open("c:\test.xls")
    4. xlApp.Visible = True
    5. xlWb.Application.Run "MacroName"
    6. xlApp.Quit
    7. Set xlWb = Nothing
    8. Set xlApp = Nothing

    Something like that?

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2001
    Posts
    364
    where do i put that in my vb, do i put it in the ole or what, please help,
    i am greatfull for all that you do

  7. #7
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    anywhere

    in your code

    You have to add a reference to Microsoft Excel Object Library

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2001
    Posts
    364
    it has an error
    Dim xlApp As New Excel.Application
    Dim xlWb As Excel.Workbook
    error >> Set << xlWb = xlApp.Workbooks.Open("c:\test.xls")
    xlApp.Visible = True
    xlWb.Application.Run "MacroName"
    xlApp.Quit
    Set xlWb = Nothing
    Set xlApp = Nothing

    error says invalid outside procedure

  9. #9
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Put all that in say

    your Form_Load event then

    or the click event of a command button.

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