Save as in Special Folder Macro

jeff07kp

New Member
Joined
Jun 17, 2008
Messages
30
Hi guys,

The script below is to save some excell sheets into
text. The macro below will safe the file with a name of a cell
but what I would like know is to save this txt into the desktop
how can I do it?

Sub ExportScheduletoText()
'
' ExportScheduletoText Macro
' Macro recorded 9/1/2008 by lumje
'

'
Range("C31:l70").Select
Selection.Copy
Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

ThisFile = Range("b1").Value
ActiveWorkbook.SaveAs Filename:=ThisFile, FileFormat:= _
xlText, CreateBackup:=False
Range("L27").Select
ActiveWorkbook.Save
ActiveWindow.Close
End Sub
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hi
try this

Dim WBN As Workbook
Dim WSN As Worksheet



WBN.SaveAs Filename:="C:\Documents and Settings\" & Environ("username") & "\Desktop\" & WSN.Cells(1, 2).Value & ".txt", _
FileFormat:=xlText, CreateBackup:=False

Regards Sten
 
Upvote 0
change to
Code:
ActiveWorkbook.SaveAs _
Filename:=CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\" & ThisFile, _
FileFormat:= xlText, CreateBackup:=False
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,394
Members
448,957
Latest member
Hat4Life

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top