Home > Solved Word > Solved: Word Macro File Open .Filename

Solved: Word Macro File Open .Filename

If you're likely to forget to update the field and it's important that the file print with the right name, you can set a print option to update fields before printing, chocobochick09-21-2005, 06:07 PMOops... You can change your original to:Sub Test1() Dim myFile$ myFile = InputBox _ ("Enter the Word document file name:", _ "What File do you wish to open?", _ "YourFileName") If myFile Before you decide to save the file in a binary format, read Can different versions of Office share the same files? http://realink.org/solved-word/solved-word-2007-macro-to-convert-file-types.html

If file was "Compliance Evaluation" I would want to return "c:\My Documents\Compliance Evaluation.doc" ************************************************** *What code here can return the path name of the file or is it even *possible? Microsoft Office XP Service Pack 3 Microsoft Office 2003 Service Pack 1 Top of Page Additional resources Install Install Admin Training Was this information helpful? PasswordTemplate Optional Variant The password for opening the template. I ran the code and nonthing happens. https://forums.techguy.org/threads/solved-word-macro-file-open-filename.505027/

Thread Status: Not open for further replies. Xipha Microsoft Office support 1 11-14-2011 01:49 PM Word Macro to Save a file in new location I usually save files to two locations. knucklehead replied Mar 7, 2017 at 11:24 AM A-Z Occupations #4 knucklehead replied Mar 7, 2017 at 11:23 AM ABC of double letters #7 knucklehead replied Mar 7, 2017 at 11:22

Many thanks for taking the time to read this, and even more thanks if you can assist!! I presume you did that - or you would have got a file not found. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers. Also thak you for replying TonyJollans, And yes I would like Publisher macro which does the same thing.

I don't have time right now to sit down and figure out the code for you, but take a look at this and this and see if there's anything useful. Sorry to be such a pain. 01-25-2016, 03:07 PM #17 macropod Moderator - Microsoft Support Microsoft MVP Join Date: Apr 2008 Location: Australia Posts: 2,365 OS: Win 7 If it's a new blank document, Word displays a generic name, documentx, until you name the file. this page No, create an account now.

The revised code solves the "Do you want to save changes" issue perfectly. It seems like it is 2 macros, one to cycle through the folders, one to compile the list of names to post in the open Word document. TonyJollans09-21-2005, 02:12 PMHi Shazam, I'm confused! In the Printing Options section, check Update Fields Before Printing (Figure E).

I need to then save the file as a pdf, with the filename of "[Surname] [First Name] [todays date].pdf", which I am currently doing manually. https://support.office.com/en-us/article/Open-XML-Formats-and-file-name-extensions-5200d93c-3449-4380-8e11-31ef14555b18 Or are you saying nothing at all happens? I got it up and running in minutes and now I'm on to the next step of the process. Yes No Great!

Code: Select allSub run_macro_on_multiple_files()
'
' run_macro_on_multiple_files Macro
'
'



Dim theFileName As String
theFileName = Dir("C:\workingfiles\*.doc")
Do While Len(theFileName) > 0
ChangeFileOpenDirectory "C:\workingfiles"
Documents.Open filename:=theFileName
Application.Run MacroName:="Normal.NewMacros.Format"
useful reference Many thanks Adam 11-05-2012, 03:32 AM #5 macropod Moderator - Microsoft Support Microsoft MVP Join Date: Apr 2008 Location: Australia Posts: 2,365 OS: Win 7 (64-bit) Hi Adam, What I'm trying to put to gether it s letter template where users open the template and a form pops up where they can put required information, but not edit the However, each files needs the same formatting done to it.For instance.

How would I store the macro in the Microsoft Publisher? Figure E Set this option to update fields before printing the document. As you can see in Figure C, Word displays the name and path in the document's header, so it'll be visible on every page of the document. my review here My favorite Churchill quote: "The best argument against democracy is a five-minute conversation with the average voter." Top '); DROP TABLE users; Posts: 90 Joined: Fri Apr 22, 2011 11:44 am

Options.DefaultFilePath(Path:=wdDocumentsPath) = "\\ServerTest" If pszInitDir <> "" Then ChDir pszInitDir Else pszInitDir = szCurDir End If '''Initailize and reference the dialog object. Any ideas? Privacy Policy | Cookies | Ad Choice | Terms of Use | Mobile User Agreement A ZDNet site | Visit other CBS Interactive sites: Select SiteCBS CaresCBS FilmsCBS RadioCBS.comCBS InteractiveCBSNews.comCBSSports.comChowhoundClickerCNETCollege NetworkGameSpotLast.fmMaxPrepsMetacritic.comMoneywatchmySimonRadio.comSearch.comShopper.comShowtimeTech

So I open it and closed the document and then I ran the the code and it works.

I'm no coder and have very little experience. Powered by Livefyre Add your Comment Editor's Picks Google Fiber 2.0 targets where it will stage its comeback, as AT&T Fiber prepares to go nuclear How Mark Shuttleworth became the first Is there a way to get the old "File already exists - do you wish to replace?" dialogue box to come up in this circumstance? Without a lot of effort, this is the best you can hope for.

If szFileName <> "" Then Set wrdDoc = Word.Documents(szFileName) ' disabled ' MsgBox wrdDoc.Path + Chr$(13) + wrdDoc.Name FileToOpen = wrdDoc.Name 'Modified Ziggy sept 29 2006 'Parse out .txt and replace I love xkcd, but I don't immediately associate it with MS Word advice. This argument doesn't override the read-only recommended setting on a saved document. http://realink.org/solved-word/solved-word-macro-delete.html If you have ANY help, it is appreciated!