Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 11-12-2017, 05:30 AM
ballpoint ballpoint is offline Find paragraph matching an expression in Word and exporting to Excel spreadsheet Windows 10 Find paragraph matching an expression in Word and exporting to Excel spreadsheet Office 2016
Advanced Beginner
Find paragraph matching an expression in Word and exporting to Excel spreadsheet
 
Join Date: Sep 2017
Posts: 42
ballpoint is on a distinguished road
Default

I am updating this thread to ask an additional question, which I think is rather important. Is it also possible to use this macro with additional matching options available in the GUI or VBA? I am thinking of IgnorePunct and IgnoreSpace, but also searching for italics, for example. They are not technically wildcards, so I understand that this may be complicated or impossible. Thanks!
Reply With Quote
  #17  
Old 11-12-2017, 05:45 AM
macropod's Avatar
macropod macropod is offline Find paragraph matching an expression in Word and exporting to Excel spreadsheet Windows 7 64bit Find paragraph matching an expression in Word and exporting to Excel spreadsheet 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

You can add all manner of conditions; it just requires more columns for them to your workbook. If you're going to work with/without formatting parameters, you also need to set the Format property appropriately; setting italics, for example, wouldn't be enough on its own. See, for example, the discussion starting at: https://www.msofficeforums.com/word-...html#post93796
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #18  
Old 11-12-2017, 07:30 AM
ballpoint ballpoint is offline Find paragraph matching an expression in Word and exporting to Excel spreadsheet Windows 10 Find paragraph matching an expression in Word and exporting to Excel spreadsheet Office 2016
Advanced Beginner
Find paragraph matching an expression in Word and exporting to Excel spreadsheet
 
Join Date: Sep 2017
Posts: 42
ballpoint is on a distinguished road
Default

I understand, but I think it is overkill for what I need. More specifically, what I would need is to just search for italicised (just about everything), rather than searching for specific italicised words. I am not sure I am making any sense, though.
Reply With Quote
  #19  
Old 11-12-2017, 12:58 PM
macropod's Avatar
macropod macropod is offline Find paragraph matching an expression in Word and exporting to Excel spreadsheet Windows 7 64bit Find paragraph matching an expression in Word and exporting to Excel spreadsheet 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

In that case, insert:
.Format = True
.Font.Italic = True
before (or after):
.Text = strFnd
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #20  
Old 11-12-2017, 01:12 PM
ballpoint ballpoint is offline Find paragraph matching an expression in Word and exporting to Excel spreadsheet Windows 10 Find paragraph matching an expression in Word and exporting to Excel spreadsheet Office 2016
Advanced Beginner
Find paragraph matching an expression in Word and exporting to Excel spreadsheet
 
Join Date: Sep 2017
Posts: 42
ballpoint is on a distinguished road
Default

Thanks! I have now tried it and the macro runs. However, it does not return any results (though it should have). I will investigate further. Paul (if I may) I am truly grateful for your help. You have already made my life significantly easier!
Reply With Quote
  #21  
Old 03-19-2018, 09:57 AM
ballpoint ballpoint is offline Find paragraph matching an expression in Word and exporting to Excel spreadsheet Windows 10 Find paragraph matching an expression in Word and exporting to Excel spreadsheet Office 2016
Advanced Beginner
Find paragraph matching an expression in Word and exporting to Excel spreadsheet
 
Join Date: Sep 2017
Posts: 42
ballpoint is on a distinguished road
Default

I am bumping up this thread as I am now trying to do something different, that is to say, extract the expressions contained between certain marks. So, for example, I would like to extract the word "artist" if it is between three asterisks and three asterisks "***" And "***", like so:

***artist***

I understand that I would have to change something in this part of the code, but I have not been lucky so far.

Code:
 xlShtOut.Range("C" & j).Value = Replace(Split(.Paragraphs(1).Range.Text, vbCr)(0), vbTab, " ")
          .Start = .Paragraphs(1).Range.End
Does anybody have any suggestions?

Thank you!
Reply With Quote
  #22  
Old 03-20-2018, 08:38 PM
macropod's Avatar
macropod macropod is offline Find paragraph matching an expression in Word and exporting to Excel spreadsheet Windows 7 64bit Find paragraph matching an expression in Word and exporting to Excel spreadsheet 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

You would have to change:
.Text = strFnd
to:
.Text = "***" & strFnd & "***"
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #23  
Old 03-21-2018, 03:32 AM
ballpoint ballpoint is offline Find paragraph matching an expression in Word and exporting to Excel spreadsheet Windows 10 Find paragraph matching an expression in Word and exporting to Excel spreadsheet Office 2016
Advanced Beginner
Find paragraph matching an expression in Word and exporting to Excel spreadsheet
 
Join Date: Sep 2017
Posts: 42
ballpoint is on a distinguished road
Default

Thanks Paul! However, I think I have not made myself clear at all—my mistake, really.

My user case is a little more specific. Since most of the paragraphs I want to extract feature a reference, I thought I would first collect the references to then collect the paragraphs. To do so, I would use the fact that most paragraphs contain a reference written in italics. By finding all italicised text, I would be able to create a collection of search strings, from which I can then remove the duplicates to conduct the search. In this context, I would be looking for strings, not the complete paragraph

The trouble is, as you told me above, searching for italics may be a problem. So I thought I'd replace all italic text with tags, such as the *** discussed above. (Though if there is a way to do this with italics, that would be amazing.) After doing that, I can either look for every string matching the *** tag (or italics, if at all possible) and create a list. Which will in turn allow me to search through my collection of documents. Does it make any sense?

Again, thank you so much for contributing to this.
Reply With Quote
  #24  
Old 03-23-2018, 02:04 PM
macropod's Avatar
macropod macropod is offline Find paragraph matching an expression in Word and exporting to Excel spreadsheet Windows 7 64bit Find paragraph matching an expression in Word and exporting to Excel spreadsheet 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

Searching for italicised text isn't a problem at all; you can even use italics as a Find parameter without specifying anything else about the text (i.e. you don't need to know what the text is). The only issue with the F/R using Excel as the source for the F/R expressions is that, if you want to find some text with/without a given attribute and other text regardless of that attribute, you'd need a column in Excel to hold those parameters.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
data extraction, regex



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find paragraph matching an expression in Word and exporting to Excel spreadsheet Exporting specific data fields from MS Word 2013 to a MS Excel 2013 spreadsheet Labyrinth Word 7 07-19-2016 01:35 PM
Exporting quiz scores from powerpoint to excel spreadsheet/word rjagile PowerPoint 1 02-08-2016 02:26 PM
Find and replace in word document repeated for every item in excel spreadsheet Daniell Word 1 02-17-2015 04:38 AM
Trying to import specific data from one spreadsheet to another, without matching rows Wynka Excel 0 11-26-2014 09:33 AM
Find paragraph matching an expression in Word and exporting to Excel spreadsheet Macro: Exporting Data to a LEGIBLE Excel Spreadsheet jeffcoleky Word VBA 6 05-08-2012 08:24 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:03 AM.


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