G
Gunnar Johansson
Hi,
I use this code in excel to paste some information into a word file, but
need to rotate the pasted picture in the wordfile. How can I do that with
this code?
Grateful to any suggestions. /Regards
Sub CopyTableToAnyWordDocument()
'Example of Word automation using early binding
'Copies range from workbook and pastes it in
'a new Word document, in a active instance of
'Word, if there is one.
'If not, opens new instance of Word
Dim wdApp As Word.Application
'Copy Named Range A1:B6 on sheet
Sheet1.Range("RFBA21").CopyPicture
On Error Resume Next
'Try to establish link to open instance of Word
Set wdApp = GetObject(, "Word.Application")
'If this fails, open Word
If wdApp Is Nothing Then
Set wdApp = GetObject("", "Word.Application")
End If
On Error GoTo 0
'With wdApp
'Add new document
' .Documents.Add
'Make Word visible
' .Visible = True
' End With
With wdApp.Selection
'Go to end of document and insert paragraph
.EndKey Unit:=wdStory
.TypeParagraph
'Paste table
'.Paste
.PasteSpecial Link:=False, _
DataType:=wdPasteMetafilePicture, _
Placement:=wdInLine, DisplayAsIcon:=False
End With
'Release object variable
Set wdApp = Nothing
End Sub
I use this code in excel to paste some information into a word file, but
need to rotate the pasted picture in the wordfile. How can I do that with
this code?
Grateful to any suggestions. /Regards
Sub CopyTableToAnyWordDocument()
'Example of Word automation using early binding
'Copies range from workbook and pastes it in
'a new Word document, in a active instance of
'Word, if there is one.
'If not, opens new instance of Word
Dim wdApp As Word.Application
'Copy Named Range A1:B6 on sheet
Sheet1.Range("RFBA21").CopyPicture
On Error Resume Next
'Try to establish link to open instance of Word
Set wdApp = GetObject(, "Word.Application")
'If this fails, open Word
If wdApp Is Nothing Then
Set wdApp = GetObject("", "Word.Application")
End If
On Error GoTo 0
'With wdApp
'Add new document
' .Documents.Add
'Make Word visible
' .Visible = True
' End With
With wdApp.Selection
'Go to end of document and insert paragraph
.EndKey Unit:=wdStory
.TypeParagraph
'Paste table
'.Paste
.PasteSpecial Link:=False, _
DataType:=wdPasteMetafilePicture, _
Placement:=wdInLine, DisplayAsIcon:=False
End With
'Release object variable
Set wdApp = Nothing
End Sub