Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #25  
Old 11-24-2014, 04:21 AM
macropod's Avatar
macropod macropod is offline How to rename the word doc with the name mentioned in the body of the document Windows 7 64bit How to rename the word doc with the name mentioned in the body of the document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

The code references 'TreatyStatement' because that's what you provided in your sample document and didn't indicate that it was variable. Accordingly, the simplest solution is to change:
Code:
      strNewNm = .SelectContentControlsByTitle("TreatyStatement/OurReference1")(1).Range.Text _
          & "_" & .SelectContentControlsByTitle("TreatyStatement/OurReference2")(1).Range.Text _
          & "." & Split(.Name, ".")(UBound(Split(.Name, ".")))
to:
Code:
      With .Tables(1).Cell(2, 2).Tables(1).Cell(3, 2).Range
        strNewNm = .ContentControls(1).Range.Text _
          & "_" & .ContentControls(2).Range.Text
      End With
      strNewNm = strNewNm & "." & Split(.Name, ".")(UBound(Split(.Name, ".")))
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to rename multiple Word file with same suffix ozil61 Word VBA 2 05-06-2014 07:36 AM
How to rename the word doc with the name mentioned in the body of the document How to specify Document Title from the body of my Document SymphonyTomorrow Word 9 08-05-2013 05:31 PM
How to rename the word doc with the name mentioned in the body of the document Rename Document & Save d4okeefe Word VBA 4 05-23-2013 09:35 AM
How to rename the word doc with the name mentioned in the body of the document How to import Word Style Headings and body text into Excel antztaylor Excel 5 11-08-2012 09:54 PM
How to rename the word doc with the name mentioned in the body of the document Advancing Paragraph Numbers in Merge Document Body Wyskers Mail Merge 1 11-30-2011 04:46 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:54 AM.


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