Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-15-2017, 02:29 PM
macropod's Avatar
macropod macropod is online now Extract Between the Parens Windows 7 64bit Extract Between the Parens 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

Quote:
Originally Posted by ChrisOK View Post
The word file also includes the other 2 mods I used to get content shaved down to this point.
I have no idea what you mean by that and I suspect it wasn't necessary.

Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim MyData As DataObject
With ActiveDocument.Range
  .Font.Hidden = True
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Format = True
    .Font.Hidden = True
    .Replacement.Font.Hidden = False
    .Forward = True
    .MatchWildcards = True
    .Wrap = wdFindContinue
    .Text = "\<xs:element name[!\>]@\>"
    .Replacement.Text = "^&"
    .Execute Replace:=wdReplaceAll
    .Format = False
    .Text = "m[ai][nx]Occurs[!\>]@\>"
    .Replacement.Text = ">"
    .Execute Replace:=wdReplaceAll
    .Text = "\<xs:element name=([!\>]@)type=([!\>]@)\>"
    .Replacement.Text = "\1^t\2^p"
    .Execute Replace:=wdReplaceAll
    .Text = "\<xs:element name=([!\>]@)\>"
    .Replacement.Text = "\1^t^p"
    .Execute Replace:=wdReplaceAll
    .Text = " ([^13^t])"
    .Replacement.Text = "\1"
    .Execute Replace:=wdReplaceAll
    .Text = Chr(34)
    .Replacement.Text = ""
    .Execute Replace:=wdReplaceAll
  End With
  .Copy
  Set MyData = New DataObject
  MyData.GetFromClipboard
  .Text = vbNullString
  .Text = MyData.GetText
  With .Find
    .Text = "^13[ ^t]*^13"
    .Replacement.Text = "^p"
    .Execute Replace:=wdReplaceAll
    .Text = "[^13]{2,}"
    .Replacement.Text = "^p"
    .Execute Replace:=wdReplaceAll
  End With
  If .Characters.First <> vbCr Then .InsertBefore vbCr
  .InsertBefore "NAME" & vbTab & "TYPE"
End With
ActiveDocument.Range.ConvertToTable vbTab, 2
Application.ScreenUpdating = True
End Sub
Note: you'll need to add a reference to the MS Forms object.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 11-15-2017, 04:03 PM
ChrisOK ChrisOK is offline Extract Between the Parens Windows 7 64bit Extract Between the Parens Office 2016
Advanced Beginner
Extract Between the Parens
 
Join Date: Sep 2016
Posts: 54
ChrisOK is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
I have no idea what you mean by that and I suspect it wasn't necessary.

Note: you'll need to add a reference to the MS Forms object.
Thank you MacroPod you're always a lifesaver with awesome help!
Forgive me, it's been a long time, I've forgotten:
Where I go to add a refc to the MS Forms Object? I was thinking it was under File>Options>?? and there was a long list of items that could be check-marked from a list...

(what I meant by the "2 mods" was that the example file that I had attached included 2 modules visible in the VBA side, that showed how I had come the current snip of content)
Reply With Quote
  #3  
Old 11-15-2017, 04:28 PM
macropod's Avatar
macropod macropod is online now Extract Between the Parens Windows 7 64bit Extract Between the Parens 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

Quote:
Originally Posted by ChrisOK View Post
Where I go to add a refc to the MS Forms Object?
In the VBE - Tools|References.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 11-15-2017, 04:39 PM
ChrisOK ChrisOK is offline Extract Between the Parens Windows 7 64bit Extract Between the Parens Office 2016
Advanced Beginner
Extract Between the Parens
 
Join Date: Sep 2016
Posts: 54
ChrisOK is on a distinguished road
Default

Ah! Found my checkbox list -- but not finding it in the list for some reason -- looked in both the MS area and Microsoft (see attachment)
Any ideas?
Attached Images
File Type: gif tools-refs-ms-forms-object-not-found3.GIF (191.0 KB, 22 views)
Reply With Quote
  #5  
Old 11-15-2017, 04:41 PM
ChrisOK ChrisOK is offline Extract Between the Parens Windows 7 64bit Extract Between the Parens Office 2016
Advanced Beginner
Extract Between the Parens
 
Join Date: Sep 2016
Posts: 54
ChrisOK is on a distinguished road
Default

Here's the ones I DO have turned on from previous projects (I moved them to the top a long time ago so I could quickly see what was active) (see attached)
Attached Images
File Type: gif ones-I-do-hv-turned-on.GIF (50.2 KB, 21 views)
Reply With Quote
Reply

Tags
extract, parens

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract name and address. donlincolnmsof Word VBA 1 11-10-2017 12:59 PM
VBA code to extract strings twozedz Excel Programming 1 05-15-2016 06:00 AM
Extract tables as images didijaba Word VBA 2 05-06-2014 06:14 PM
Extract Photographs The Gap PowerPoint 4 04-22-2010 07:00 AM
Extract from String using Wildcard whousedmy Word 0 05-21-2009 01:35 AM

Other Forums: Access Forums

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