PC Review


Reply
Thread Tools Rate Thread

Changing name to txt external file

 
 
=?Utf-8?B?Um95?=
Guest
Posts: n/a
 
      21st Apr 2006
hi

i export a table from access to a txt file. now i want to rename the file
with vba code. is that possible??

other solution would be to export the file with the correct name, but i dont
know how to specify the name from a macro
the file must be named "21042006 150700.txt" ( now() )

any ideas...?

thanks
 
Reply With Quote
 
 
 
 
Brendan Reynolds
Guest
Posts: n/a
 
      21st Apr 2006

Though it seems to be undocumented now, the old BASIC Name ... As ... syntax
still works in VBA ...

Public Sub TestName()

Name CurrentProject.Path & "\cws.xml" As CurrentProject.Path &
"\renamed.xml"

End Sub

--
Brendan Reynolds
Access MVP

"Roy" <(E-Mail Removed)> wrote in message
news8044496-9FBF-41AD-BED7-(E-Mail Removed)...
> hi
>
> i export a table from access to a txt file. now i want to rename the file
> with vba code. is that possible??
>
> other solution would be to export the file with the correct name, but i
> dont
> know how to specify the name from a macro
> the file must be named "21042006 150700.txt" ( now() )
>
> any ideas...?
>
> thanks



 
Reply With Quote
 
kerry_ja@yahoo.com
Guest
Posts: n/a
 
      21st Apr 2006
Hi Roy,

I think the easiest way would be to export it with the correct name,
which is probably just changing the name in quotes above, but to rename
a file, one way is through the File System Object as in the following
example:

Dim objFileSystem As Object
Dim objFile As Object
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
Set objFile = objFileSystem.GetFile("Old File Path/Name")
Let objFile.Name = "New File Name"

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the link to an external text file? Maury Markowitz Microsoft Access 2 29th Sep 2008 09:55 PM
Changing external links john w Microsoft Access External Data 2 4th Dec 2006 06:59 PM
import external data from changing file name =?Utf-8?B?bmF0aGFu?= Microsoft Excel Worksheet Functions 2 6th Apr 2005 04:39 PM
Changing External References OhJackie Microsoft Excel Worksheet Functions 3 11th Oct 2004 11:17 AM
Hardware changing name! external HD =?Utf-8?B?UmVn?= Windows XP Hardware 5 29th Aug 2004 05:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:59 AM.