Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 02-16-2015, 07:38 AM
bracketandquotes bracketandquotes is offline macro to add brackets to each line and add single quotes to each word in the line Windows 8 macro to add brackets to each line and add single quotes to each word in the line Office 2010 32bit
Novice
macro to add brackets to each line and add single quotes to each word in the line
 
Join Date: Feb 2015
Posts: 8
bracketandquotes is on a distinguished road
Default

It works . Many thanks Graham for taking the time and having the patience to do up the code.



Many thanks also to Andrew and Paul for taking the time to do up the codes.

You all have been a great help on this

David
Reply With Quote
  #17  
Old 02-16-2015, 12:54 PM
macropod's Avatar
macropod macropod is offline macro to add brackets to each line and add single quotes to each word in the line Windows 7 64bit macro to add brackets to each line and add single quotes to each word in the line 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

Quote:
Originally Posted by bracketandquotes View Post
Ive attached a sample doc as original is too big.
Your sample document has tabs, not spaces, between the strings. Do you want tabs, or spaces, in the output?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #18  
Old 02-16-2015, 03:51 PM
Guessed's Avatar
Guessed Guessed is offline macro to add brackets to each line and add single quotes to each word in the line Windows 7 32bit macro to add brackets to each line and add single quotes to each word in the line Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
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

And based on your new information of the tab separator, my suggestion would be
Code:
Sub SQLiser()
  Dim oPara As Paragraph
  Dim oRng As Range, oParaRng As Range
  
  Set oRng = ActiveDocument.Range
  oRng.Text = Replace(oRng.Text, vbTab, "', '")
  For Each oPara In oRng.Paragraphs
    Set oParaRng = oPara.Range
    oParaRng.MoveEnd Unit:=wdCharacter, Count:=-1
    oParaRng.Text = "('" & oParaRng.Text & "'),"
  Next oPara
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to add brackets to each line and add single quotes to each word in the line How many points is line spacing 'single'? Ugeen Word 2 11-24-2013 03:14 PM
macro to add brackets to each line and add single quotes to each word in the line Changing single-quotes to double-quotes Bobosmite Word 5 04-15-2013 06:40 AM
From the command line, how do I run a Word macro? jdockstader Word 7 02-04-2013 06:09 AM
Single Line Spacing for Short Lists? tatihulot Word 2 04-20-2010 02:53 PM
macro to add brackets to each line and add single quotes to each word in the line Different alignments in a single line George99 Word 2 01-24-2010 05:49 PM

Other Forums: Access Forums

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