Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Need to export to text results not formula

I need to export only the results to a text file not the formulas.
I have vlookups that when I export the formula goes to the text file
but instead I need only the results of the query.
I am usnig the following macro:

Public Sub SaveAsTXT()
fileSaveName = Application.GetSaveAsFilename( _
FileFilter:="Text Files (*.txt), *.txt")
If fileSaveName < False Then
MsgBox "Save as " & fileSaveName
End If
End Sub

Thank you,

Muaitai

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default Need to export to text results not formula

I think maybe the easiest way to do this is to kind of start over. The code
you have will save the entire workbook, just renamed with a .txt extension
instead of a .xls extension.

Try using some code similar to this, lets assume you want to save the
information on rows 1 through 50 on a sheet in .txt format (and there are
several to choose from), this is for MS-DOS text, no delimiters:

Sub SaveDataAsText()
Rows("1:50").Select
ActiveWorkbook.SaveAs Filename:="G:\ExcelHelp_21June2006.txt", _
FileFormat:=xlTextMSDOS
End Sub

Now that has the filename hard coded, you could use other code to get a
filename from the user or yourself.

If we change things a little, it all can be done in a single macro

Sub SaveDataAsText()
Dim fName As Variant
Rows("1:50").Select

fName = Application.GetSaveAsFilename( _
fileFilter:="MS-DOS text files (*.txt), *.txt")
If fName = "" Then ' user [Cancel]ed
Exit Sub
End If

On Error Resume Next
ActiveWorkbook.SaveAs Filename:=fName, _
FileFormat:=xlTextMSDOS If Err < 0 Then
'user probably cancelled at this point
'as when notified of existing file of same name
'you can either test for errors
'or simply ignore them
Err.Clear
End If
On Error GoTo 0 ' clear error trapping
End Sub


"Muaitai" wrote:

I need to export only the results to a text file not the formulas.
I have vlookups that when I export the formula goes to the text file
but instead I need only the results of the query.
I am usnig the following macro:

Public Sub SaveAsTXT()
fileSaveName = Application.GetSaveAsFilename( _
FileFilter:="Text Files (*.txt), *.txt")
If fileSaveName < False Then
MsgBox "Save as " & fileSaveName
End If
End Sub

Thank you,

Muaitai


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Need to export to text results not formula

You have a response at your first post.

Muaitai wrote:

I need to export only the results to a text file not the formulas.
I have vlookups that when I export the formula goes to the text file
but instead I need only the results of the query.
I am usnig the following macro:

Public Sub SaveAsTXT()
fileSaveName = Application.GetSaveAsFilename( _
FileFilter:="Text Files (*.txt), *.txt")
If fileSaveName < False Then
MsgBox "Save as " & fileSaveName
End If
End Sub

Thank you,

Muaitai


--

Dave Peterson
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
How do I change formula results by changing the text color of the bailfire13 Excel Discussion (Misc queries) 4 May 31st 06 04:41 PM
Why does formula show rather than results (not in text format) Caseybay Excel Worksheet Functions 4 April 24th 06 08:51 PM
formula OR text Bob Jones Excel Discussion (Misc queries) 5 August 15th 05 07:53 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 07:48 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 03:28 AM


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

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"