×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

I am trying to export an range of e

I am trying to export an range of e

I am trying to export an range of e

(OP)
I am trying to export an range of excel cells into word via a VBA macro and I would like to paste the cells in word as a picture. I have tried the following which doesnt work
as I get an error message on the paste command -runtime error 4605-command is not available - this concerns the paste as wdchartpicture :


Sub ExportDatasheet()

Dim DocWord As Word.Document
Dim AppWord As Word.Application
Dim WordDocPath As String


'request the path and word doc name where it should be send
WordDocPath = InputBox("Provide the Exact Path and Word file name where the datasheet is to be exported", "Input Path", "c:\Datasheet.doc")
' Copy excel Sheet
ThisWorkbook.Worksheets("Datasheet").Range("A1:K227").Copy

'establish link to Word
Set AppWord = New Word.Application
Application.DisplayAlerts = True
AppWord.ShowMe
AppWord.Visible = True


'open document Word
Set DocWord = AppWord.Documents.Open(WordDocPath, ReadOnly:=False)

With DocWord
    .Range.PasteAndFormat Type:=wdChartPicture
End With

Application.CutCopyMode = False
DocWord.Application.ActiveDocument.Save
AppWord.Application.Quit

Set AppWord = Nothing
Set DocWord = Nothing


End Sub


Has anyone a tips to solve this problem. I have tried many things and exhausted all my resources.
R

RE: I am trying to export an range of e


Replace this ->
   With DocWord
      .Range.PasteAndFormat Type:=wdChartPicture
   End With

with this ->
   DocWord.Range.PasteSpecial Link:=False, DataType:=wdPasteMetafilePicture

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources