View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Udd. Udd. is offline
external usenet poster
 
Posts: 4
Default Export access table to notepad

I'm after some help please. I'm trying though excel to open up access and
export a table to notepad. Having never done anything like this i'm
struggling. I've mashed bits of code together that i've found on here but i'm
still missing something. Can you look at the code below and point out where
i'm going wrong or even suggest a better way?

Sub access()
Dim ac As Object
On Error Resume Next

Set ac = GetObject(, "Access.Application")

If ac Is Nothing Then
Set ac = GetObject("", "Access.Application")
ac.OpenCurrentDatabase "k:\warehouse\lm's\test.mdb"
Else
AppActivate "Microsoft Access"
End If

DoCmd.TransferText acExportDelim, , "tbl_main", "E:\test.txt"
ac.Quit

End Sub

Many thanks,

Richard.