Group: microsoft.public.word.vba.general
From: "Jonathan West"
Date: Friday, April 04, 2008 12:24 PM
Subject: Re: Excel Range To Word


"Paul W Smith" wrote in message
news:ewFczdnlIHA.2368@TK2MSFTNGP03.phx.gbl...
>I have written code that I thought successfully copies an Excel range into
>a Word document....but when I copy a range that contains more than one cell
>something strange is happening which I hope someone can explain.
>
> I have attached a Word Doc which shows the issue.
>
> If this document is viewed in Reading Layout then the Excel ranges are not
> visible.
>
> If the document is viewed in Print Layout View then the Excel ranges are
> visible.
>
> The single cell Excel range imports work, the currency totals being an
> example.
>
> My code:
>
> Currency Total
> DealTotal = sCurrency & "Total"
> Doc.Selection.GoTo what:=wdGoToBookmark, Name:=DealTotal
> shtInvoice.Range("InvoiceRate").Copy
> Doc.Selection.PasteSpecial DataType:=wdPasteText
>
> Excel Range
> DealBookmark = sCurrency & "Deals"
> Doc.Selection.GoTo what:=wdGoToBookmark, Name:=DealBookmark
> shtInvoice.Range("InvoiceDeals").SpecialCells(xlCellTypeVisible).Copy
> Doc.Selection.Paste
>
> I know I use two slightly different techniques but I cannot understand why
> one works correctly but the other sometimes invisible text.

I don't know why one technique is pasting a table containing invisible text,
but you can easily set all the text to be visible by this line of code

Doc.Range.Font.Hidden = False


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup


Safety Articles | Usenet Groups | Usenet News | Bluegrass