![]() |
Create Folder and Text File in folder
Hey guys
On each users Windows 2000 Professional Desktop directory, I need to create a directory called "RDFMTD". How do I make sure I get to their desktop as well as how do I create a Folder called "RDFMTD"? Also how do I create a file in the RDFMTD directory called RDFMTD.txt? Thanks Todd Huttenstine |
Create Folder and Text File in folder
Try this to create a folder "RDFMTD"
Sub test() Dim wsh As Object Dim fs As Object Dim DesktopPath As String Dim DirString As String Set wsh = CreateObject("WScript.Shell") Set fs = CreateObject("Scripting.FileSystemObject") DesktopPath = wsh.SpecialFolders.Item("Desktop") DirString = DesktopPath & "\RDFMTD" If Not fs.FolderExists(DirString) Then fs.CreateFolder DirString Else End If End Sub Look forWrite in the VBA help for creating a txt file -- Regards Ron de Bruin http://www.rondebruin.nl "Todd Huttentsine" wrote in message ... Hey guys On each users Windows 2000 Professional Desktop directory, I need to create a directory called "RDFMTD". How do I make sure I get to their desktop as well as how do I create a Folder called "RDFMTD"? Also how do I create a file in the RDFMTD directory called RDFMTD.txt? Thanks Todd Huttenstine |
Create Folder and Text File in folder
You can do this also to create a the folder and TXT file
Sub test2() Dim wsh As Object Dim fs As Object Dim DesktopPath As String Dim DirString As String Dim fname As String Dim wb As Workbook Set wsh = CreateObject("WScript.Shell") Set fs = CreateObject("Scripting.FileSystemObject") DesktopPath = wsh.SpecialFolders.Item("Desktop") DirString = DesktopPath & "\RDFMTD" If Not fs.FolderExists(DirString) Then fs.CreateFolder DirString Else End If Application.ScreenUpdating = False fname = DirString & "\RDFMTD.txt" Workbooks.Add xlWBATWorksheet Set wb = ActiveWorkbook With wb .SaveAs fname, FileFormat:=xlText .Close False End With Application.ScreenUpdating = True End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Ron de Bruin" wrote in message ... Try this to create a folder "RDFMTD" Sub test() Dim wsh As Object Dim fs As Object Dim DesktopPath As String Dim DirString As String Set wsh = CreateObject("WScript.Shell") Set fs = CreateObject("Scripting.FileSystemObject") DesktopPath = wsh.SpecialFolders.Item("Desktop") DirString = DesktopPath & "\RDFMTD" If Not fs.FolderExists(DirString) Then fs.CreateFolder DirString Else End If End Sub Look forWrite in the VBA help for creating a txt file -- Regards Ron de Bruin http://www.rondebruin.nl "Todd Huttentsine" wrote in message ... Hey guys On each users Windows 2000 Professional Desktop directory, I need to create a directory called "RDFMTD". How do I make sure I get to their desktop as well as how do I create a Folder called "RDFMTD"? Also how do I create a file in the RDFMTD directory called RDFMTD.txt? Thanks Todd Huttenstine |
All times are GMT +1. The time now is 01:50 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com