jwcolby
jwcolby at colbyconsulting.com
Tue Jun 23 09:15:27 CDT 2009
I just found code that does the TransferText in a completely different way. I have never seen a
text control use these properties and methods. Is this something new in 2007 or does this go back
to some previous version? What is the advantage of this over the normal TransferText?
http://support.microsoft.com/kb/113905
Sub Command1_Click ()
Dim cmd As String ' Holds DDEExecute command.
On Error GoTo DDEerr ' Error trap.
' Make sure there isn't an existing DDE conversation:
text1.LinkMode = 0
' Set up the DDE link:
text1.LinkTopic = "MSACCESS|C:\ACCESS\NWIND.MDB"
text1.LinkItem = "All"
text1.LinkMode = 2
' DDEExecute command to import text file into Microsoft Access Table:
cmd = "[TransferText ,,'Shippers','C:\ACCESS\SHIPPERS.TXT']"
' Execute the TransferText command and close the DDE link:
text1.LinkExecute cmd
text1.LinkMode = 0
MsgBox "Transfer OK"
Exit Sub
DDEerr:
' An error has occurred.
MsgBox Error
MsgBox "Error in transfer."
Exit Sub
End Sub
--
John W. Colby
www.ColbyConsulting.com