S
Simon Baker
I have been trying to paste a specified range of cells in Excel into Word as
an enhanced metafile, using the code below (modified from a listing in Guy
Hart-Davis' excellent book on Word VBA). If I paste as text or RTF, there is
no problem, but when I try and paste as a metafile, I get the following error:
"Run-time error 5342: The specified data type is not available"
Any thoughts?
Thanks in advance
Simon
Sub Getting_Value_from_Excel()
Dim MySpreadsheet As Excel.Workbook
Dim strSalesTotal As String
Set MySpreadsheet = _
GetObject("c:\Sales Forecast.xls")
With MySpreadsheet.Application
.Visible = True
.Parent.Windows("Sales Forecast.xls").Visible = True
.Range("salestotal").Copy
.Workbooks("Sales Forecast.xls").Saved = True
.Quit
End With
Set MySpreadsheet = Nothing
Selection.PasteSpecial DataType:=wdPasteEnhancedMetafile
End Sub
an enhanced metafile, using the code below (modified from a listing in Guy
Hart-Davis' excellent book on Word VBA). If I paste as text or RTF, there is
no problem, but when I try and paste as a metafile, I get the following error:
"Run-time error 5342: The specified data type is not available"
Any thoughts?
Thanks in advance
Simon
Sub Getting_Value_from_Excel()
Dim MySpreadsheet As Excel.Workbook
Dim strSalesTotal As String
Set MySpreadsheet = _
GetObject("c:\Sales Forecast.xls")
With MySpreadsheet.Application
.Visible = True
.Parent.Windows("Sales Forecast.xls").Visible = True
.Range("salestotal").Copy
.Workbooks("Sales Forecast.xls").Saved = True
.Quit
End With
Set MySpreadsheet = Nothing
Selection.PasteSpecial DataType:=wdPasteEnhancedMetafile
End Sub