Hi,
I use the following code below to copy from a range in Excel to a bookmark in Word. Can someone help me to write the code for the reverse operation, copying from Word to Excel?
--------------------------------------------
Public Sub CopyFromExcelToWord()
Dim xl As Excel.Application
Set xl = CreateObject("Excel.Application"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
xl.Workbooks.Open ("myExcelFile.xls"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
ActiveWorkbook.Worksheets("Sheet1"
.Activate
xl.ActiveSheet.Range("MyRange"
.Copy
ActiveDocument.Bookmarks("MyBookmark"
.Select
Selection.PasteSpecial
End Sub
--------------------------------------------
I tried doing the reverse, i.e.
ActiveDocument.Bookmarks("MyBookmark"
.Copy
but it seems to give an error saying that an argument is required for the copy, which I haven't been able to figure out. Sorry, if this problem seems trivial - I am not an expert VBA programmer.
Thanks,
Pradipto
I use the following code below to copy from a range in Excel to a bookmark in Word. Can someone help me to write the code for the reverse operation, copying from Word to Excel?
--------------------------------------------
Public Sub CopyFromExcelToWord()
Dim xl As Excel.Application
Set xl = CreateObject("Excel.Application"
xl.Workbooks.Open ("myExcelFile.xls"
ActiveWorkbook.Worksheets("Sheet1"
xl.ActiveSheet.Range("MyRange"
ActiveDocument.Bookmarks("MyBookmark"
Selection.PasteSpecial
End Sub
--------------------------------------------
I tried doing the reverse, i.e.
ActiveDocument.Bookmarks("MyBookmark"
but it seems to give an error saying that an argument is required for the copy, which I haven't been able to figure out. Sorry, if this problem seems trivial - I am not an expert VBA programmer.
Thanks,
Pradipto