View Single Post
 
Old 08-10-2015, 01:02 PM
equalizer88 equalizer88 is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Jul 2015
Posts: 15
equalizer88 is on a distinguished road
Default Word VBA need apostrophe for string but commented out

Trying to insert text at beginning of all text files in folder.
part of relevant code below. if wrd = "start" no issues.
but my text is long.

1. First problem is that after \n editor inserts " mark at end of first line. Why?
2. The other lines start with ' (such as 'Text1')
so obviously, the lines are commented out.

What is easy way to insert long text with ' marks?




Dim oRng As Range
Dim i As Long
Set oRng = DocSrc.Range 'oRng set to entire document
wrd = "030100 FILL, DECLARE, GLOBAL, DECIMAL, LIST, \n 'zzz-NUM', 'yyy-NUM' \n," _
'Text1', 'Text2', 'Text3', _
'Text4', 'DESC1', 'DESC2', 'DESC3', _
'DESC4'
oRng.InsertBefore wrd
Reply With Quote