Jaymond Flurrie
Well-known Member
- Joined
- Sep 22, 2008
- Messages
- 921
- Office Version
- 365
- Platform
- Windows
I'm having problems pasting a chart to Word:
First paste works perfectly, but second one gives me Run-time error '5342': The specified datatype is unavailable. What's wrong and how to correct it?
edit. I'm using Office 2010 and that second one works if I change that Link:=True to Link:=False
Code:
With appWD.Selection
.MoveRight Unit:=wdCharacter, Count:=1
.TypeText Text:="A part of header"
.ParagraphFormat.Alignment = wdAlignParagraphLeft
.TypeText Text:=vbTab & vbTab & "Six digits"
DocWD.ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
strChartName = "A. My first title"
shtCharts.Shapes(strChartName).Copy
.TypeText Text:=vbTab & vbTab & vbTab & vbTab & strChartName & vbCrLf
.Font.Bold = wdToggle
.PasteSpecial Link:=False, DataType:=wdPasteMetafilePicture, Placement:=wdInLine, DisplayAsIcon:=False
.InsertBreak Type:=wdPageBreak
strChartName = "B. My second title"
shtCharts.Shapes(strChartName).Copy
.TypeText Text:=vbTab & vbTab & vbTab & vbTab & strChartName & vbCrLf
.Font.Bold = wdToggle
.PasteSpecial Link:=True, DataType:=wdPasteEnhancedMetafile, Placement:=wdInLine, DisplayAsIcon:=False
.InsertBreak Type:=wdPageBreak
End With
First paste works perfectly, but second one gives me Run-time error '5342': The specified datatype is unavailable. What's wrong and how to correct it?
edit. I'm using Office 2010 and that second one works if I change that Link:=True to Link:=False
Last edited: