View Single Post
 
Old 01-05-2012, 10:14 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,577
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Hi tpcervelo,

That's quite easy. Try something based on:
Code:
'Note: This code requires a reference to the Excel object model
Dim xlApp As New Excel.Application
Dim xlWkBk As Excel.Workbook
Dim StrWkbk As String, StrWkSht As String, i As Long
StrWkbk = "workbook path & filename"
' eg: StrWkbk = "C:\Users\tpcervelo\Documents\Test.xls"
StrWkSht = "Sheet Name"
Set xlWkBk = xlApp.Workbooks.Open(FileName:=StrWkbk, AddtoMRU:=False)
With xlWkBk
  With .Worksheets(StrWkSht)
  i = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
    .Cells(i, 1).Value = "word field 1"
    .Cells(i, 2).Value = "word field 2"
    .Cells(i, 3).Value = "word field 3"
    .Cells(i, 4).Value = "word field 4"
    .Cells(i, 5).Value = "word field 5"
    .Cells(i, 6).Value = "word field 6"
    .Cells(i, 7).Value = "word field 7"
    .Cells(i, 8).Value = "word field 8"
  End With
  .Save
  .Close
End With
xlApp.Quit
Set xlWkBk = Nothing: Set xlApp = Nothing
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote