Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-28-2023, 11:24 PM
Dimsok Dimsok is offline Save file with the name of selected text Windows XP Save file with the name of selected text Office 2007
Advanced Beginner
Save file with the name of selected text
 
Join Date: Sep 2014
Location: exUSSR
Posts: 50
Dimsok is on a distinguished road
Default 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?
Reply With Quote
  #2  
Old 03-29-2023, 02:50 PM
Guessed's Avatar
Guessed Guessed is offline Save file with the name of selected text Windows 10 Save file with the name of selected text Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,975
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
  #3  
Old 04-02-2023, 10:55 PM
Dimsok Dimsok is offline Save file with the name of selected text Windows XP Save file with the name of selected text Office 2007
Advanced Beginner
Save file with the name of selected text
 
Join Date: Sep 2014
Location: exUSSR
Posts: 50
Dimsok is on a distinguished road
Default

Second. But first also could be usefull in some cases.
Reply With Quote
  #4  
Old 04-02-2023, 11:11 PM
Guessed's Avatar
Guessed Guessed is offline Save file with the name of selected text Windows 10 Save file with the name of selected text Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,975
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
  #5  
Old 04-02-2023, 11:47 PM
Dimsok Dimsok is offline Save file with the name of selected text Windows XP Save file with the name of selected text Office 2007
Advanced Beginner
Save file with the name of selected text
 
Join Date: Sep 2014
Location: exUSSR
Posts: 50
Dimsok is on a distinguished road
Default

Thanks, I will try it.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Save file with the name of selected text Footnote formatting>"Apply changes to selected text" not limiting changes to selected text Swarup Word 11 07-26-2022 01:51 PM
Save file with the name of selected text Find and Replace Selected Text or Macro for finding selected text mrplastic Word VBA 4 12-20-2019 01:25 PM
Save file with the name of selected text 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
Save file with the name of selected text Word Macro: Save file as text with current file name jabberwocky12 Word VBA 2 10-22-2010 12:23 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:32 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft