View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
J J is offline
external usenet poster
 
Posts: 1
Default Macro-Text from word doc paste to excel empty row

Hi all!
I think that I am very close to the answer on this question so any
assistance you could give would be greatly appreciated!
I am calling a macro from word to format a page of text then copy and
open an excel doc paste it to the first *empty* row in this
spreadsheet.
So far I have:

[more code above...]
'Opens an Excel worksheet located in the default Documents folder


strXLPath = "C:\Fill_the_Bank_MasterList.xls"

Set objExcelApp = CreateObject("Excel.Application")
objExcelApp.Workbooks.Open (strXLPath)
Set objExcelBook = objExcelApp.ActiveWorkbook
Set objExcelSheets = objExcelBook.Worksheets
Set objExcelSheet = objExcelBook.Sheets(1)
objExcelSheet.Activate
objExcelApp.Application.Visible = True

'Paste clipboard into first empty row
'

objExcelSheet.Range("ListTop").Select
objExcelSheet.Selection.End(xlDown).Select <--- Error 438 here
objExcelSheet.ActiveCell.Offset(1, 0).PasteSpecial


End Sub

I get an error 438 on this (obj or property not supported on the line
as indicated. I can paste these lines into excel and run the macro
from inside excel, but when I run from word, I get the error. Should I
set this before I run in word?

Thanks again!