Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 06-10-2014, 07:16 AM
SarahBear SarahBear is offline Inserting a Word Module into excel Windows 7 32bit Inserting a Word Module into excel Office 2010 32bit
Novice
Inserting a Word Module into excel
 
Join Date: Jun 2014
Posts: 13
SarahBear is on a distinguished road
Default

Sure thing!

Here's the code:

Sub explodelist()
'
' explodelist Macro
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ", "
.Replacement.Text = "^n"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.WholeStory
Selection.Cut
End Sub



What this does is, I take a list of ingredients seperated by commas and paste it into word. When I run the macro, the program does [find and replace to replace each instance of a comma followed by a space (, ) with a page break (^n). Then it selects all and cuts it onto the clipboard] so I can paste it into excel, where it appears in seperate cells within a column rather than the whole list in paragraph form, which is how it started.

The brackets surround my description of exactly what the macro does. My main goal for this is to be able to acomplish the same thing without having to be clicking back and forth between windows all the time.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting a Word Module into excel Inserting text from one word file into another based on an excel input jmaxcy Excel 14 11-01-2013 04:07 PM
Inserting text from one word file into another based on an excel input jmaxcy Word 3 11-01-2013 01:26 AM
AZWizard Module - ?hidden module pcaldwell Word 1 08-22-2012 01:19 PM
Inserting a Word Module into excel Inserting excel spreadsheet into word doc educpara58 Excel 2 07-28-2011 01:22 AM
bad module "Italian Grammar" crashes Word townsend0406 Word 0 04-20-2009 11:04 PM

Other Forums: Access Forums

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