Hi! I'm trying to import data in to an existing workbook. When i run the macro in the existing workbook, a new workbook opens and the data is dropped there. What do i need to change to get the data to pull back in to the existing workbook? Any help would be very appreciated!!
Thanks...
Sub Pull_Accruals()
'
' Pulls current month accruals
'
'
Workbooks.OpenDatabase Filename:= _
"F:\My Documents\My Data Sources\crp840 Finapp ExpenseBudgets$Export.odc", _
CommandText:=Array("""Finapp"".""dbo"".""ExpenseBudgets$Export"""), _
CommandType:=xlCmdTable, ImportDataAs:=xlTable
ActiveSheet.ListObjects("Table_crp840_Finapp_ExpenseBudgets_Export").Range. _
AutoFilter Field:=1, Criteria1:="ACCRUAL"
ActiveSheet.ListObjects("Table_crp840_Finapp_ExpenseBudgets_Export").Range. _
AutoFilter Field:=3, Criteria1:="2008"
ActiveSheet.ListObjects("Table_crp840_Finapp_ExpenseBudgets_Export").Range. _
AutoFilter Field:=2, Criteria1:="10"
ActiveSheet.ListObjects("Table_crp840_Finapp_ExpenseBudgets_Export").Range. _
AutoFilter Field:=6, Criteria1:=Array("820201", "820202", "820203", "820204", _
"820205", "820206", "820207", "820208"), Operator:=xlFilterValues
ActiveSheet.ListObjects("Table_crp840_Finapp_ExpenseBudgets_Export").Range. _
AutoFilter Field:=7, Criteria1:="44505"
End Sub
Bookmarks