#1
|
|||
|
|||
Save file with the name of selected text
I have found macro, which add current data to name of saved file. As i noticed, when i save new document, it will save by default with the name of first string. Is it possible to save new doc with the name of selected text in that document? |
#2
|
||||
|
||||
What is the macro you are using to do this?
Are you trying to do the save as: 1. without user intervention or 2. presenting a dialog that is pre-filled so the user can either just click OK or change location and name
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
Second. But first also could be usefull in some cases.
|
#4
|
||||
|
||||
Doug Robbins posted a macro a long time ago that gives us the basic code which can be adapted to your requirements. I've added an arbitrary limit so your default filename doesn't get too long.
Code:
Sub FeedMeSeymour() Dim fd As FileDialog Set fd = Application.FileDialog(msoFileDialogSaveAs) With fd .InitialFileName = Left(Selection.Text, 50) If .Show <> 0 Then 'if the user didn't press the cancel button .Execute End If End With Set fd = Nothing End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#5
|
|||
|
|||
Thanks, I will try it.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Footnote formatting>"Apply changes to selected text" not limiting changes to selected text | Swarup | Word | 11 | 07-26-2022 01:51 PM |
Find and Replace Selected Text or Macro for finding selected text | mrplastic | Word VBA | 4 | 12-20-2019 01:25 PM |
How do I use as Save As to take the name from a text and change the file path? | rosscortb | Word VBA | 5 | 03-08-2018 04:30 AM |
Save Document as Text File | gerison | Word VBA | 5 | 11-27-2017 07:15 AM |
Word Macro: Save file as text with current file name | jabberwocky12 | Word VBA | 2 | 10-22-2010 12:23 PM |