tags:

views:

261

answers:

0

Hi I need to have a vb code in ms word 2003 that copy a a specific cell in excel file and paste it in word (filed). belwo what i have done and it result in error.

thanks

h.khuraidah

quote Sub cmdGetNumber() Dim XL As Object Dim WBEx As Object Dim ExelWS As Object Dim appwd As Object Dim wdApp As Word.Application

''''

'On Error GoTo OLE_ERROR Set XL = CreateObject("Excel.Application") Set wdApp = CreateObject("Word.Application")

'Open Excel document Set WBEx = XL.Workbooks.Open("C:\Documents and Settings\121567\Desktop\tafket1.xls") Set ExelWS = WBEx.Worksheets("Sheet1") XL.Visible = True 'appwd.Visible = True

ExelWS.Range("c2").Select 'Selection.Copy

'wdApp.Selection.PasteSpecial Placement:=wdInLine, DataType:=wdPasteMetafilePicture 'wdApp.Documents.Save Set wdApp = Nothing Set ExelWS = Nothing Set WBEx = Nothing

End Sub

unquote