Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Deleting a file using VB

Hello All,

I have delimted text files that I import into Excel using
macros. Once the import is finished, I would like to
delete the text file because it contains SS#'s and other
sensitive info. How do I delete the file from Excel using
VB? The text files are normally located on a LAN.

Thanks in advance,
Rohit Thomas
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Deleting a file using VB

Kill "X:\Myfiles\*.txt"

Anyway, look at the Kill command - after the files are closed.

Kill doesn't put files in the recycle bin. It deletes them and they are
gone - so test, then use carefully.

Regards,
Tom Ogilvy


"Rohit Thomas" wrote in message
...
Hello All,

I have delimted text files that I import into Excel using
macros. Once the import is finished, I would like to
delete the text file because it contains SS#'s and other
sensitive info. How do I delete the file from Excel using
VB? The text files are normally located on a LAN.

Thanks in advance,
Rohit Thomas



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Deleting a file using VB


Kill "C:\ImportentSecretFile.Csv"

Wendel

"Rohit Thomas" skrev i meddelandet
...
Hello All,

I have delimted text files that I import into Excel using
macros. Once the import is finished, I would like to
delete the text file because it contains SS#'s and other
sensitive info. How do I delete the file from Excel using
VB? The text files are normally located on a LAN.

Thanks in advance,
Rohit Thomas



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Deleting a file using VB

Rohit,
This is a modified bit of code that should work. It
assumes that all of the files that will be deleted are in
the same directory, and that there are no other files in
that directory. Hope this helps!!

Eric W.
Madison, WI

Sub Delete_Files()

'Dimension your variables
Dim sFolder
Dim myFolderObject, myGetFolder, myFile, myFiles
myFolder = "g:\eric\files\"
'set your objects
Set myFolderObject = CreateObject
("Scripting.FileSystemObject")
Set myGetFolder = myFolderObject.GetFolder(myFolder)
Set myFiles = f.Files
'loop through the files in a directory
For Each myFile In myFiles
'Delete the appropriate files
myFile.Delete
Next

End Sub
-----Original Message-----
Hello All,

I have delimted text files that I import into Excel

using
macros. Once the import is finished, I would like to
delete the text file because it contains SS#'s and other
sensitive info. How do I delete the file from Excel using
VB? The text files are normally located on a LAN.

Thanks in advance,
Rohit Thomas
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting a file Jo[_3_] Excel Discussion (Misc queries) 1 March 29th 09 02:50 AM
Deleting a file via a macro Sarah at DaVita Excel Discussion (Misc queries) 5 October 6th 08 10:43 PM
deleting a file Abhishek kedia Excel Discussion (Misc queries) 1 April 22nd 06 02:49 PM
Deleting a file from within Excel Night Owl Excel Worksheet Functions 3 May 14th 05 04:10 PM
After deleting a macro, I still get the pop-up when opening file Anne Excel Worksheet Functions 2 December 8th 04 05:31 PM


All times are GMT +1. The time now is 12:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"