Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Edit Word Table from Excel using vba code
Hi,
Office 2003. I'm trying to delete paragraph marks from inside the tables of a Word Document opened via VBA code from Excel but Excel keeps crashing on me. Can anyone suggest a correction please? Each table is selected ok but doesn't seem to like the ".Replacement.Text" line in code below:- Sub ReplaceParaMarksInTable() Dim intTables As Integer Dim intX As Integer If ActiveDocument.Tables.Count = 1 Then intTables = ActiveDocument.Tables.Count For intX = 3 To intTables With ActiveDocument.Tables(intX).Range .Select .Find.ClearFormatting .Find.Replacement.ClearFormatting With .Find .Text = "^p" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With .Find.Execute End With Next intX End If End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Edit Word Table from Excel using vba code
On 31 Aug, 10:40, John_R_Fry
wrote: Hi, Office 2003. I'm trying to delete paragraph marks from inside the tables of a Word Document opened via VBA code from Excel but Excel keeps crashing on me. Can anyone suggest a correction please? Each table is selected ok but doesn't seem to like the ".Replacement.Text" line in code below:- Sub ReplaceParaMarksInTable() Dim intTables As Integer Dim intX As Integer If ActiveDocument.Tables.Count = 1 Then intTables = ActiveDocument.Tables.Count For intX = 3 To intTables With ActiveDocument.Tables(intX).Range .Select .Find.ClearFormatting .Find.Replacement.ClearFormatting With .Find .Text = "^p" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With .Find.Execute End With Next intX End If End Sub Are you sure it's that line - I would suspect the wdFindContinue myself - this is a Word constant, and should be replaced with it's numeric value of 1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I paste an EXCEL chart from a word doc into EXCEL and edit it | Excel Discussion (Misc queries) | |||
Can't edit Excel or Word documents | Excel Discussion (Misc queries) | |||
how to protect a word art in excel from edit | Excel Worksheet Functions | |||
Code to Delete Empty Rows in a Word Table | Excel Programming | |||
code to export excel table to word | Excel Programming |