Copy a spreedsheet

S

Sofia Grave

Hej to all.
I am using Excel 2007 SP2.
I have a command button in my spreedsheet to copy a select area.
But when I copy to a word document it copies also the gridlines. To avoid
this I have to remove always the gridlines in excel before pressing the
button.
the button is only
selection.copy.

How can I copy without THE GRID but keeping the grid in the excel
spreedsheet.

In word I make a paste special - windows enchanted file

Thanks for the time.
Sofia grave
 
J

Joel

I odn't know if PasteSpecial into word and select Text only will work. If
not try this code

'performing a copy without after/before will create new workbook
set newsht = activesheet.copy
with newsht
'add you code here to delete the gridlines on new worksheet
end with
'kill new workbook
newsht.parent.close savechanges:=false
 
J

john

I am no expect copying data from Excel to word but in a quick play, I came up
with this - see if it gives you some ideas.

Hope helpful

Sub ExcelWord()
' requires a reference to the Word Object library:
' in the VBE select Tools, References and check the
' Microsoft Word X.X object library

Dim appWord As Word.Application

Set appWord = New Word.Application

appWord.Visible = True

Range("D6:G10").Copy

appWord.Documents.Add.Content.PasteSpecial Link:=False, _
DataType:=wdPasteText, _
Placement:=wdInLine, _
DisplayAsIcon:=False

Application.CutCopyMode = False

Set appWord = Nothing

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top