Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello all
I created a function which has two things to do. First, it is used to copy a range excel value (e.g. A1:D8). Another function, it is used to copy a cell value (e.g. F10) on the same excel worksheet and return to the value to the caller function. The range of excel value can't be pasted under MS Word bookmark. But, the range of cxcel value can't be pasted under the bookmark. Sometime, MS Word bookmark is pasted by the function code. How can I solve the problem? My code prototype: Function ModuleInAccess() Dim xlApp As Excel.Application Dim xlWorkbook As Excel.Workbook Dim xlWorksheet As Excel.Worksheet Dim strReturnValue Set xlApp = CreateObject("Excel.Application") Set xlWorksheet = xlApp.Workbooks.Open(Filename:=ExcelWorkbookName) xlWorksheet("Sheet1").Select .... strReturnValue = xlWorksheet.Range("F10").value .... With xlWorksheet("Sheet1").Range(Cells(1,1),Cells(8,4)) ..Select ..Copy End With MSAccessFunction = strReturnValue End Function Function CallerModuleInAccess() Dim wdApp As Word.Application Dim strGetReturnValue As String Set wdApp = CreateObject("Word.Application") With wdApp strGetReturnValue = ModuleInAccess ..ActiveDocument.Bookmarks("bookmark1").Range.Text = strGetReturnValue ..ActiveDocument.Bookmarks("bookmark2").Range.Past e <-- Paste the copied range of cells value End With End Function I don't know why it can copy and paste a cell value, but the range of cells value can't be pasted. Could anyone give me some suggestion on solving this problem? Thanks Cheers Bon |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy and paste range of cells excluding hidden data in excel | Excel Discussion (Misc queries) | |||
How do I copy data in Excel cells and paste in Word w/o cell borde | Excel Discussion (Misc queries) | |||
hyperlink from Excel to a Word bookmark | Excel Discussion (Misc queries) | |||
How do I copy selected cells in excel and paste into word table | Excel Programming | |||
IsEmpty and bookmark help with excel 97 and word 97 | Excel Programming |