Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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





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
create a file list from a folder? Hal239 Excel Discussion (Misc queries) 2 February 5th 09 03:32 PM
how do you create file folder labels in excel? rebecca_vsp New Users to Excel 2 May 16th 08 02:00 AM
Need code to save file to new folder, erase from old folder Ron M. Excel Discussion (Misc queries) 1 February 24th 06 06:02 PM
How do I Create backup of excel file in other folder khalid Excel Discussion (Misc queries) 1 May 24th 05 11:01 AM
Create Folder / Copy Folder / Replace Murray Outtrim[_2_] Excel Programming 0 February 24th 04 06:40 PM


All times are GMT +1. The time now is 09:29 PM.

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

About Us

"It's about Microsoft Excel"