Hello all,

I am looking to find a method to do the following:

I have an Excel spreadsheet. In this spreadsheet I have a number of cells
that contain, calculated, information. In order to publish this information
in a convenient way, I would like to do this with a Word document, rather
than formatting a document in Excel.

All I need to have is to find the code to import the contents of a cell to a
bookmark in Word. I can't find this info anywhere.

--
Imexgra vzw
Borzestraat 29
B-2000 Antwerpen
Tel.: +32 (0)3 233 43 93
Fax: +32 (0)3 233 34 60
http://www.imexgra.org

RE: data from Excel cell into Word bookmark by HelmutWeber

HelmutWeber
Thu Mar 30 06:37:01 CST 2006

Hi Luc,

not quite simple.

Here is just the principle for getting something
from Excel into an encluding bookmark, like [TextText].

Sub ExcelinWord2()
' reference to Excel library set !
Dim oExlApp As Excel.Application
Dim oExlWrk As Excel.Workbook
Dim oExlSht As Excel.Worksheet
Dim oExlVal As String
Dim oWrdRng As Range

Set oExlApp = New Excel.Application
Set oExlWrk = oExlApp.Workbooks.Open("c:\test\excel\keller-01.xls")
Set oExlSht = oExlWrk.Sheets(1)

oExlVal = oExlSht.Cells(1, 1).Value

oExlWrk.Close
oExlApp.Quit
Set oExlApp = Nothing
Set oExlWrk = Nothing
Set oExlSht = Nothing

With ActiveDocument.Range.Bookmarks("Mark01")
Set oWrdRng = .Range
.Range.Text = oExlVal
oWrdRng.End = oWrdRng.start + Len(oExlVal)
oWrdRng.Bookmarks.Add Name:="Mark01"
End With

End Sub

Ask again, if you need further help or clarification.

--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000

Re: data from Excel cell into Word bookmark by Shauna

Shauna
Thu Mar 30 06:41:40 CST 2006

Hi Luc

You can do this by controlling Word from Excel or vice versa. For example,
see:
Control Excel from Word
http://www.word.mvps.org/FAQs/InterDev/ControlXLFromWord.htm

For information on inserting text into a bookmark, see
Inserting text at a bookmark without deleting the bookmark
http://www.word.mvps.org/FAQs/MacrosVBA/InsertingTextAtBookmark.htm

For a simple example of putting data from Excel into Word, see
http://groups.google.com/group/microsoft.public.word.vba.beginners/browse_frm/thread/f9a9fcee31bc92b4/84174f6a0c42d15e

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word


"Luc Weyn" <fotoluc@dinges.hotmail.com> wrote in message
news:Zb2dnRcV_tmmWrbZRVny2A@scarlet.biz...
> Hello all,
>
> I am looking to find a method to do the following:
>
> I have an Excel spreadsheet. In this spreadsheet I have a number of cells
> that contain, calculated, information. In order to publish this
> information
> in a convenient way, I would like to do this with a Word document, rather
> than formatting a document in Excel.
>
> All I need to have is to find the code to import the contents of a cell to
> a
> bookmark in Word. I can't find this info anywhere.
>
> --
> Imexgra vzw
> Borzestraat 29
> B-2000 Antwerpen
> Tel.: +32 (0)3 233 43 93
> Fax: +32 (0)3 233 34 60
> http://www.imexgra.org
>
>



Re: data from Excel cell into Word bookmark by Luc

Luc
Fri Mar 31 04:53:23 CST 2006

Many thanks for a very useful answer. I will have a look at these websites
asap.

Best regards,

Luc

"Shauna Kelly" <ShaunaKelly@SendNoSpamToShaunaKelly.com> schreef in bericht
news:O8dZNd$UGHA.4348@TK2MSFTNGP09.phx.gbl...
> Hi Luc
>
> You can do this by controlling Word from Excel or vice versa. For example,
> see:
> Control Excel from Word
> http://www.word.mvps.org/FAQs/InterDev/ControlXLFromWord.htm
>
> For information on inserting text into a bookmark, see
> Inserting text at a bookmark without deleting the bookmark
> http://www.word.mvps.org/FAQs/MacrosVBA/InsertingTextAtBookmark.htm
>
> For a simple example of putting data from Excel into Word, see
>
http://groups.google.com/group/microsoft.public.word.vba.beginners/browse_frm/thread/f9a9fcee31bc92b4/84174f6a0c42d15e
>
> Hope this helps.
>
> Shauna Kelly. Microsoft MVP.
> http://www.shaunakelly.com/word
>
>
> "Luc Weyn" <fotoluc@dinges.hotmail.com> wrote in message
> news:Zb2dnRcV_tmmWrbZRVny2A@scarlet.biz...
> > Hello all,
> >
> > I am looking to find a method to do the following:
> >
> > I have an Excel spreadsheet. In this spreadsheet I have a number of
cells
> > that contain, calculated, information. In order to publish this
> > information
> > in a convenient way, I would like to do this with a Word document,
rather
> > than formatting a document in Excel.
> >
> > All I need to have is to find the code to import the contents of a cell
to
> > a
> > bookmark in Word. I can't find this info anywhere.
> >
> > --
> > Imexgra vzw
> > Borzestraat 29
> > B-2000 Antwerpen
> > Tel.: +32 (0)3 233 43 93
> > Fax: +32 (0)3 233 34 60
> > http://www.imexgra.org
> >
> >
>
>