0 ratings 0% found this document useful (0 votes) 8 views 6 pages VBA save selection
The document is a discussion thread from the MrExcel Message Board where users seek help on saving a selection from an Excel workbook as a text file. It includes code snippets and suggestions for using macros to facilitate this process. Additionally, users share their experiences and modifications to the code for better functionality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here .
Available Formats
Download as PDF or read online on Scribd
Carousel Previous Carousel Next
Save VBA save selection For Later r99 12/8128 saving selection as text fle | MrExcel Message Board
Ml
Forums What's new New post cel Articles
‘New posts Search forums Board Rules
I you would like to pos, please check out the MrExcel Message Board FAQ and register here, Ifyou forgot your password, you can reset
your password.
Forums Question Forums Bxeal Questions
sovemseven.
saving selection as text file
suze en
B I can‘ figure out how to save a selection asa tex file. | just want ADVERTISEMENT
tosave a highighted section of workbook as text flo use
in access, Any suggestions?
pmasrzone 28
/AOVERISEMENT
Recommended viteos Poneresby Sond
[21 vi 3.2.76,359_pred Tue Aug 5
2025 08:35:03" ouTv@009 (UTC)
SAfunetion(e) var e-()s function 4(0)
{Aecein} return t[9] expores;var
Seta] (han, 1,exports:Q} return
ela} call(aceports, 2,2. exports, 1), 2
Lnle,a.exports} tomes ivert,dodefuncel
once,t,n).
‘{ole,t)| lobject.deFineProperty(e,t,
fi: Usors/AdministratoriOneDrive/Desktopivbalsaving selection as txt flo _ MrExcel Message Board.html 8179 ra828 ving sacton ae Mic Manage Bord
Excel Facts
0 How w all formulas in Ex: oO
© clk hereto reves ansner,
LU wre eerenranttoatn natant sve aa tera 0
Copy the selection tothe claboard open vp “ensue 0
Netbook or at vet ppeatn you use, pst
itinthere and save as Not elegant and sen butt
ewes Mating fee sve atts a hole ft more
wma ate ert and folng sound Bt you wants Macro
inom tnt Jot then tea ferent so.
‘Ad this code to 2 module and run it. The code will ask you to select the range to save and then askyou for ()
the folder to save to. JSW
sub myt5e0
Actnshet dette
ADVERTISEMENT x
ActiveSheet Paste
‘Ask user for folder to save text fle to,
imyFolder = Application GetSaveAsFilename(ieilter="Text Files ("bet *tx")
‘Save selected data as text file in users selected folder.
‘ActiveWorkbook Saveas Filename:=myFolder, Fileformat:=xlText, CresteBackuy
‘Remove temporary sheet _
Application ScreenUpdating = False
Application DisplayAlerts = False
{i:s¢:/Usors/AdministratoriOneDrive/Desktopivalsaving selection as text flo _ MrExcel Message Board.htmi 216r99 12/8128 saving selection as text fle | MrExcel M
ActiveWindow SelectedSheets Delete
Application DisplayAlets
Application SereenUpd:
"indicate save action
MsgBox “Text Fle: " & myFolder & "Saved!
‘Go to top of sheet
Range(At") Select
End Sub
sage Board
= Tue
Tue
L “This works GREAT. Thanks aoverisnwent
dan 12008
‘Addthis code toa module and runt. The code wil ask you ta select the range to save and then ask you forthe folder
to sive to. SW
eb, 2002 340 Click to expand
‘THisis ke something | need as wel
Instead of saving a range of calls | need to select the contents ofa Controls TextBox and save it toa text fle
How do you select the contents of TextBox to do that?
(Ob, when | licked Cancel | gat an error. This modification fixes that
cove
AD veRISeMENT
‘Thank you!
rm wondering i you could show a version ofthis code poverrisauent
showing how to lock in the cell range and eliminate
the cell range question,
{i:1HC:/Users/AdministratoriOneDrive/Desktopivalsaving selection as text flo _ MrExcel Message Board.htmir99 12/8128 saving selection as text fla | MrExcel Message Board
New Member | Thanks in advance for your assistance,
Nov 2017 6g
Nov 122017 <8
Like this
code
Sa Seb myrsave
Fluff Dim myFolder As String
rcacl WP, Modertor | 'By Jos tos
sun 12,2014 52724
385 Windows [eotoR=#£0000] Sange ("A1:¢10") [/COLOR] select
eca(mtost™) «Select
myFolder = Applicavion.GetsavensFlenane (:sleFlteri="Text Files (*.txt), *.txt"
‘enove temporary sheet
Application. dieplayalerts = True
"go te top of sheet
‘Where the portion in re isthe range to copy
| digs
J ‘Thank you for reviewing and correctly eiting the cellranqe: However the raul did nat da what 1 wae
hoping for. This macro seems to be saving everything to
be able to save the desired cell data (HSH23 data} to ast
Ab wenisewent
‘This will save the fleas an MSDOS text fle with a fle
extension of ene
coae
Fluff Sub myrsave(
{:s¢:/Usors/AdministratoriOneDrive/Desktopivbalsaving selection as text flo _ MrExcel Message Board.htmlr99 12/8128
sun 32,2014 ‘S224
365) Windows
Sheets (reset) Sel
‘ask user for to:
ook. Savens tt lename!-nyFolde?
er to save text tale t
Negtox “Text Filo
"Go to top of sheet
Range ("Al") «Select
nd Sab
Next
Similar threads
T
A
M
Share
Forum statistics
Save As Dialog Box with File Name Predetermined for Ppt file through Excel
‘okbnale-Now 12, 228- Gea Questions
Saving dialog box hanging after running macro
sor 28- 0 2, 2024- Bc Cerone
Need help saving an already open pdf file using name from spreadsheet
‘through VBA
MatnewBiarayNov24 2024 xc! Questions
& myfoldor 6 “savoc
Multiple users accessing the same spreadsheet via SharePoint
‘aS Dec 12, 2024: Exel Questions
Data Transfer from Excel to PowerPoint and getting POF file of PPT
Muhammad Nish Mahood Nov 30,2024 xcel Guettons
f#XMstoOoses
Share this page
AD veRISeMENT
©
saving selection as text fla | MrExcel Message Board
View
eps
View
eps
Vis
eps
Views
fi: Usors/AdministratoriOneDrive/Desktopivbalsaving selection as txt flo _ MrExcel Message Board.html
‘You mustog in or rgitr to reply here.
2 SOEs +
333 Alex Bskendurg
cca Marhensiorsay M
3 eelr99 12/8128 saving selection as text fle | MrExcel Message Board
Forums Question Forums Excel Questions
AD veRISeMENT
‘i: Usors/AdministratoriOneDrive/Desktopivalsaving selection as txt flo _ MrExcel Message Board.html