Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-11-2018, 03:43 PM
justinmo justinmo is offline macro to change part of the name of an existing Word file Windows 10 macro to change part of the name of an existing Word file Office 2016
Novice
macro to change part of the name of an existing Word file
 
Join Date: Sep 2018
Posts: 7
justinmo is on a distinguished road
Default macro to change part of the name of an existing Word file

I currently use the following macro to scrub, password protect, and save Word files. Each filename contains the text "(IU)". I would like to amend the macro so that it will also replace "(IU)" with "(CR)" in the filename, before saving it.

Sub ThirdPartyDocsScrubLockSaveClose()
'
' ThirdPartyDocsScrubLockSaveClose Macro
'
'


ActiveDocument.RemoveDocumentInformation (wdRDIDocumentProperties)
ActiveDocument.RemoveDocumentInformation (wdRDIDocumentServerProperties)
ActiveDocument.RemoveDocumentInformation (wdRDIContentType)
ActiveDocument.Protect Password:="12345", NoReset:=False, Type:= _
wdAllowOnlyReading, UseIRM:=False, EnforceStyleLock:=True
CommandBars("Restrict Editing").Visible = False
ActiveDocument.Save
ActiveDocument.Close
End Sub
Reply With Quote
  #2  
Old 09-11-2018, 04:44 PM
macropod's Avatar
macropod macropod is offline macro to change part of the name of an existing Word file Windows 7 64bit macro to change part of the name of an existing Word file Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,341
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

Try:
Code:
Sub ThirdPartyDocsScrubLockSaveClose()
With ActiveDocument
  .RemoveDocumentInformation (wdRDIDocumentProperties)
  .RemoveDocumentInformation (wdRDIDocumentServerProperties)
  .RemoveDocumentInformation (wdRDIContentType)
  .Protect Password:="12345", NoReset:=False, Type:=wdAllowOnlyReading, UseIRM:=False, EnforceStyleLock:=True
  .SaveAs2 FileName:=Replace(.FullName, "(IU)", "(CR)"), AddToRecentFiles:=False
  .Close False
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 09-11-2018, 06:08 PM
justinmo justinmo is offline macro to change part of the name of an existing Word file Windows 10 macro to change part of the name of an existing Word file Office 2016
Novice
macro to change part of the name of an existing Word file
 
Join Date: Sep 2018
Posts: 7
justinmo is on a distinguished road
Default

That worked. Thank you very much.
Reply With Quote
Reply

Tags
modify filename



Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to change part of the name of an existing Word file Inserting Only Part of File Name in Word ClaireLivings Word 1 04-14-2016 08:08 AM
macro to change part of the name of an existing Word file how to make navigation part closed when we open our existing MS word document Deniz Word 1 02-28-2016 09:01 AM
Change color of existing borders for an existing table JayUSA PowerPoint 1 01-21-2016 04:21 PM
Change one page number in existing TOC Word 2013 MK-NY Word 2 04-03-2014 03:59 AM
hey guys, need to edit a certain part of a word file but its greyed out winter83 Word 0 08-17-2010 07:04 PM

Other Forums: Access Forums

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


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