+ Reply to Thread
Results 1 to 3 of 3

Use VBA to collect information from Excel cells to av word documen

  1. #1
    Øyvind
    Guest

    Use VBA to collect information from Excel cells to av word documen

    I have reference Office 11.0 Object lib. as a default. To get all the Excel
    objects i activate the Microsoft Excel 11.0 Object library.

    Then i can brows it all, by then i create a VBA code then VBA can't use the
    Excel Objects as :
    Dim Text as string
    Text=cstr(Workbooks("BookName.xls").Worksheets("SheetName").Cells(1,1))

    I have tried a line i use in VB6

    Dim XLS
    Dim Text as string
    set XLS = GetObject(, "Excel.Application")

    XLS.Workbooks("BookName.xls").Worksheets("SheetName").Cells(1,1))

    This gives med tha same as
    Text =cstr(Exel.Workbooks("BookName.xls").Worksheets("SheetName").Cells(1,1))

    I can brows the object model, but i can't use it.

    Is there an other code that enebles the Excel object model in WORD.

    Best regards





    --
    Øyvind

  2. #2
    Tom Ogilvy
    Guest

    Re: Use VBA to collect information from Excel cells to av word documen

    GetObject and CreateObject are the ways to go.

    IF it works in VB6, it should work in VBA

    I assume you have opened BookName.xls and it has a sheet named SheetName

    You may want to look at the Automation Help file

    http://support.microsoft.com/default...b;en-us;260410
    Microsoft Office 2000 automation Help file is available in the Download
    Center

    --
    Regards,
    Tom Ogilvy

    "Øyvind" <[email protected]> wrote in message
    news:[email protected]...
    > I have reference Office 11.0 Object lib. as a default. To get all the

    Excel
    > objects i activate the Microsoft Excel 11.0 Object library.
    >
    > Then i can brows it all, by then i create a VBA code then VBA can't use

    the
    > Excel Objects as :
    > Dim Text as string
    > Text=cstr(Workbooks("BookName.xls").Worksheets("SheetName").Cells(1,1))
    >
    > I have tried a line i use in VB6
    >
    > Dim XLS
    > Dim Text as string
    > set XLS = GetObject(, "Excel.Application")
    >
    > XLS.Workbooks("BookName.xls").Worksheets("SheetName").Cells(1,1))
    >
    > This gives med tha same as
    > Text

    =cstr(Exel.Workbooks("BookName.xls").Worksheets("SheetName").Cells(1,1))
    >
    > I can brows the object model, but i can't use it.
    >
    > Is there an other code that enebles the Excel object model in WORD.
    >
    > Best regards
    >
    >
    >
    >
    >
    > --
    > Øyvind




  3. #3
    Øyvind
    Guest

    Re: Use VBA to collect information from Excel cells to av word doc

    I had activated the workbook with current sheet. I read the automation help
    file.
    Thank you Tom.
    --
    Øyvind


    "Tom Ogilvy" wrote:

    > GetObject and CreateObject are the ways to go.
    >
    > IF it works in VB6, it should work in VBA
    >
    > I assume you have opened BookName.xls and it has a sheet named SheetName
    >
    > You may want to look at the Automation Help file
    >
    > http://support.microsoft.com/default...b;en-us;260410
    > Microsoft Office 2000 automation Help file is available in the Download
    > Center
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Øyvind" <[email protected]> wrote in message
    > news:[email protected]...
    > > I have reference Office 11.0 Object lib. as a default. To get all the

    > Excel
    > > objects i activate the Microsoft Excel 11.0 Object library.
    > >
    > > Then i can brows it all, by then i create a VBA code then VBA can't use

    > the
    > > Excel Objects as :
    > > Dim Text as string
    > > Text=cstr(Workbooks("BookName.xls").Worksheets("SheetName").Cells(1,1))
    > >
    > > I have tried a line i use in VB6
    > >
    > > Dim XLS
    > > Dim Text as string
    > > set XLS = GetObject(, "Excel.Application")
    > >
    > > XLS.Workbooks("BookName.xls").Worksheets("SheetName").Cells(1,1))
    > >
    > > This gives med tha same as
    > > Text

    > =cstr(Exel.Workbooks("BookName.xls").Worksheets("SheetName").Cells(1,1))
    > >
    > > I can brows the object model, but i can't use it.
    > >
    > > Is there an other code that enebles the Excel object model in WORD.
    > >
    > > Best regards
    > >
    > >
    > >
    > >
    > >
    > > --
    > > Øyvind

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1