Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save Worksheet at .txt
Hello. I would like a macro to save a worksheet as a .csv file in folder on my C drive. The worksheet will vary in size (rows an columns). The sheet must use tabs as a delimiter. Thanks for your help -- Sandema ----------------------------------------------------------------------- Sandeman's Profile: http://www.excelforum.com/member.php...fo&userid=3244 View this thread: http://www.excelforum.com/showthread.php?threadid=52922 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save Worksheet at .txt
A CSV file uses commas as delimiters
Activesheet.copy Application.DisplayAlerts = False ActiveWorkbook.SaveAs "C:\Myfolder\Myfile.txt", xlText Application.DisplayAlerts = True Activeworkbook.Close SaveChanges:=False -- Regards, Tom Ogilvy "Sandeman" wrote: Hello. I would like a macro to save a worksheet as a .csv file in a folder on my C drive. The worksheet will vary in size (rows and columns). The sheet must use tabs as a delimiter. Thanks for your help! -- Sandeman ------------------------------------------------------------------------ Sandeman's Profile: http://www.excelforum.com/member.php...o&userid=32440 View this thread: http://www.excelforum.com/showthread...hreadid=529220 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save Worksheet at .txt
Thanks Tom. Doesn't appear to work though as I get an error statin some of the cells contain more than 255 characters, which stops th macro in its tracks. Is there a workaround or another option -- Sandema ----------------------------------------------------------------------- Sandeman's Profile: http://www.excelforum.com/member.php...fo&userid=3244 View this thread: http://www.excelforum.com/showthread.php?threadid=52922 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save Worksheet at .txt
Maybe
Dim wks As Worksheet Dim newWks As Worksheet Set wks = ActiveSheet wks.Copy Set newWks = ActiveSheet wks.Cells.Copy newWks.Range("a1").PasteSpecial Paste:=xlPasteValues Application.DisplayAlerts = False newWks.Parent.SaveAs "C:\Myfile.txt", xlText Application.DisplayAlerts = True newWks.Parent.Close SaveChanges:=False Sandeman wrote: Thanks Tom. Doesn't appear to work though as I get an error stating some of the cells contain more than 255 characters, which stops the macro in its tracks. Is there a workaround or another option? -- Sandeman ------------------------------------------------------------------------ Sandeman's Profile: http://www.excelforum.com/member.php...o&userid=32440 View this thread: http://www.excelforum.com/showthread...hreadid=529220 -- Dave Peterson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Save Worksheet at .txt
That's the ticket. Thanks Dave -- Sandema ----------------------------------------------------------------------- Sandeman's Profile: http://www.excelforum.com/member.php...fo&userid=3244 View this thread: http://www.excelforum.com/showthread.php?threadid=52922 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I save only active worksheet without save all of worksheet | Excel Worksheet Functions | |||
When you hit Save on a template, how can you save as worksheet? | Excel Worksheet Functions | |||
'Save current worksheet'; 'Open next worksheet' - two command buttons | Excel Discussion (Misc queries) | |||
Save As - changes worksheet name | Excel Programming | |||
Worksheet Buttons (Save, Save As, Cut, Paste, etc.) Not Working | Excel Worksheet Functions |