Macro to export as Text, only the results not the formula

C

cjasantos

Hi,

I am using this macro to export to a text file but I have vlookups and
other formulas that when I export only the formula gets exported, what
I need i to export ONLY the results of the query.

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
 
D

Dave Peterson

Your code doesn't show how you saved the file.

If fileSaveName <> False Then
MsgBox "Save as " & fileSaveName
activeworkbook.saveas filename:=filesavename, fileformat:=xltext
End If

You may want to record a macro when you save the file manually so that you get
the fileformat that you really want.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top