Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-29-2019, 02:27 AM
dita dita is offline Run Macro for DOC files in different folders Windows XP Run Macro for DOC files in different folders Office 2010 64bit
Advanced Beginner
Run Macro for DOC files in different folders
 
Join Date: Apr 2018
Posts: 34
dita is on a distinguished road
Default Run Macro for DOC files in different folders

Hello!

I´m looking for a Macro who can make the following:

1.- Open DOC files (version 2010) in different folders under the same level

For example:
\folder A\
\subfolder_1\doc1.doc
\subfolder_2\doc2.doc
\subfolder_3\doc3.doc
\subfolder_4\doc4.doc

2.- Run a macro that it changes the font size from 8pt to 11pt for all of them



3.- After that, create a PDF for all DOC files

Would that be possible?
Reply With Quote
  #2  
Old 01-29-2019, 03:36 AM
macropod's Avatar
macropod macropod is offline Run Macro for DOC files in different folders Windows 7 64bit Run Macro for DOC files in different folders Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

See, for example: https://www.msofficeforums.com/word-...tml#post125011
The code there doesn't do the font changes & pdf creation you want, but it does show how to loop through all files in a nested series of folders.

It's also not clear from your post whether you want a single PDF for all files in the folder, or a separate PDF for each file: the latter is easy; the former could get complicated if different page layouts have been used.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-29-2019, 05:14 AM
dita dita is offline Run Macro for DOC files in different folders Windows XP Run Macro for DOC files in different folders Office 2010 64bit
Advanced Beginner
Run Macro for DOC files in different folders
 
Join Date: Apr 2018
Posts: 34
dita is on a distinguished road
Default

Great, I will look into this thread and will see how the macro works for nested series of folders.

Sorry for being unclear. I want a separate PDF for each file.
Reply With Quote
  #4  
Old 01-29-2019, 01:39 PM
macropod's Avatar
macropod macropod is offline Run Macro for DOC files in different folders Windows 7 64bit Run Macro for DOC files in different folders Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

For PDF creation, you'd uncomment the line:
Code:
    '.SaveAs2 FileName:=Split(.Fullname, ".doc")(0) & ".pdf", FileFormat:=wdFormatPDF, AddToRecentFiles:=False
replace the line:
Code:
   Call RefreshFields(wdDoc)
with:
Code:
   .Range.Font.Size = 11
and change the line:
Code:
   .Close SaveChanges:=True
to:
Code:
   .Close SaveChanges:=False
You also don't need the RefreshFields sub.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Re-importing files, folders into Outlook 2010 bugmeso Outlook 1 02-04-2018 10:59 AM
Searching through folders/ subfolders and rename files if certain condition is met mihnea96 Excel 1 05-15-2017 07:09 AM
show folders and files in listbox megatronixs Outlook 0 10-26-2014 06:41 AM
list folders and files using .vbs file josianne Excel Programming 3 08-18-2014 03:03 PM
copy, sync files across 2 folders 1 pc spgprivate Office 0 06-20-2013 08:41 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:53 PM.


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