Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-14-2021, 04:25 PM
Guessed's Avatar
Guessed Guessed is offline Using Find & Replace in Word instead of GREP Function in Adobe Indesign Windows 10 Using Find & Replace in Word instead of GREP Function in Adobe Indesign Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
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

Assuming your don't want to deal with xml-based code and the attribute order is always consistent, you could use something like this to extract the content


Code:
Sub Macro1()
  Dim sText As String, arrText() As String, i As Integer, sOutput As String
  sText = ActiveDocument.Paragraphs(1).Range.Text
  arrText = Split(sText, """")
'  For i = LBound(arrText) To UBound(arrText)
'    Debug.Print i, arrText(i)
'  Next i
  sOutput = arrText(9) & vbLf & arrText(3) & vbLf & arrText(15) & vbLf & arrText(1)
  Debug.Print sOutput
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #2  
Old 10-14-2021, 07:20 PM
Jakov93 Jakov93 is offline Using Find & Replace in Word instead of GREP Function in Adobe Indesign Windows 10 Using Find & Replace in Word instead of GREP Function in Adobe Indesign Office 2010
Advanced Beginner
Using Find & Replace in Word instead of GREP Function in Adobe Indesign
 
Join Date: Jul 2021
Posts: 51
Jakov93 is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
Assuming your don't want to deal with xml-based code and the attribute order is always consistent, you could use something like this to extract the content
Firstly, thank you for your reply
Secondly, dear Andrew, after running your macro, no changes happen.
Thirdly, the numbers inside parenthesis in your code, what represent?:
Code:
sOutput = arrText(9) & vbLf & arrText(3) & vbLf & arrText(15) & vbLf & arrText(1)
because I want to add additional attributes such as "Type".
Lastly, do you want to attach a demo file?
Reply With Quote
Reply

Tags
find & replace, find replace;wildcards, word vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Some text are missing while importing into Adobe InDesign Muthukumaran Word 2 07-23-2019 11:30 PM
Using Find & Replace in Word instead of GREP Function in Adobe Indesign Function in a Macro used to Find & Replace koehlerc14 Word VBA 3 02-15-2019 11:59 AM
Using Find & Replace in Word instead of GREP Function in Adobe Indesign Find and Replace function shooting off screen to the left of the document Mattblack Word 1 04-10-2014 03:06 PM
Indesign Table to MS word for Editing Kathy Neal Word Tables 1 01-15-2013 07:56 AM
Using Find & Replace in Word instead of GREP Function in Adobe Indesign Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:01 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