Nils001
07-04-2015, 01:33 AM
Hello,
I have a table in Excel, which i have copied into a picture, rotated it and changed the size. Then i would like to copy to picture into word, but I have a bit trouble copying the picture from Excel into Word. I have been trying to use the code below (and others). It does only copy a tiny object into word, which is not the table. I am using office 2013.
'Insert benchmarkingtable
'copy graph
wbk3.Worksheets("LR_tabel").Shapes("B_tabel").Copy
'Go to bookmark
wdApp.Selection.Goto What:=Word.wdGoToBookmark, Name:="btabel"
'Insert graph in word
wdApp.Selection.PasteSpecial DataType:=Word.wdPasteDefault
This i how the picture is made, which works fine:
'copy the graph into a picture, rotate it and change the size
Range(wbk3.Worksheets("LR_tabel").Cells(1, 1), wbk3.Worksheets("LR_tabel").Cells(slut(5), 2 + antalKategorier)).Select
Selection.Copy
Range(wbk3.Worksheets("LR_tabel").Cells(slut(5) + 2, 1), wbk3.Worksheets("LR_tabel").Cells(slut(5) + 2, 1)).Select
wbk3.Worksheets("LR_tabel").Pictures.Paste.Name = "B_tabel"
wbk3.Worksheets("LR_tabel").Shapes.Range(Array("B_tabel")).Select
Selection.ShapeRange.IncrementRotation 90
Selection.ShapeRange.Width = Application.CentimetersToPoints(28)
Help will be very much appreciated!
I have a table in Excel, which i have copied into a picture, rotated it and changed the size. Then i would like to copy to picture into word, but I have a bit trouble copying the picture from Excel into Word. I have been trying to use the code below (and others). It does only copy a tiny object into word, which is not the table. I am using office 2013.
'Insert benchmarkingtable
'copy graph
wbk3.Worksheets("LR_tabel").Shapes("B_tabel").Copy
'Go to bookmark
wdApp.Selection.Goto What:=Word.wdGoToBookmark, Name:="btabel"
'Insert graph in word
wdApp.Selection.PasteSpecial DataType:=Word.wdPasteDefault
This i how the picture is made, which works fine:
'copy the graph into a picture, rotate it and change the size
Range(wbk3.Worksheets("LR_tabel").Cells(1, 1), wbk3.Worksheets("LR_tabel").Cells(slut(5), 2 + antalKategorier)).Select
Selection.Copy
Range(wbk3.Worksheets("LR_tabel").Cells(slut(5) + 2, 1), wbk3.Worksheets("LR_tabel").Cells(slut(5) + 2, 1)).Select
wbk3.Worksheets("LR_tabel").Pictures.Paste.Name = "B_tabel"
wbk3.Worksheets("LR_tabel").Shapes.Range(Array("B_tabel")).Select
Selection.ShapeRange.IncrementRotation 90
Selection.ShapeRange.Width = Application.CentimetersToPoints(28)
Help will be very much appreciated!