473,322 Members | 1,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Syntax Error for Macro_help needed to find

Running a macro to format tables in a Word document - setting colors and Bolding labels work fine. I get a 'syntax' error when trying to FormatTables. Here is the part of the code that troubles me.


Sub FormatTables()



BoldLabels



' Format the tables

ActiveDocument.Select

Index = 1

Continue = True



Do While Continue = True

Selection.Find.ClearFormatting

With Selection.Find

.Text = "REQID"

.Replacement.Text = ""

.Forward = True

End With

Selection.Find.Execute

Do While Selection.Paragraphs(Index).Range.Characters.Count > 1

unitsMoved = Selection.MoveDown(Unit:=wdLine, Count:=1, Extend:=wdExtend)

If unitsMoved = 1 Then

Index = Index + 1

End If

Selection.Expand wdParagraph

'MsgBox "Index = " + Str$(Index), , "Warning"

Loop

Selection.MoveUp Unit:=wdLine, Count:=1, Extend:=wdExtend

Selection.Expand wdLine



Index = 1

Continue = Selection.Find.Found

'DefListSep = getListSeparator()

'setListSeparator ("=")


If Continue = True Then


Selection.ConvertToTable Separator:=wdSeparateByDefaultListSeparator_,

NumColumns:=2, NumRows:=1, Format:=wdTableFormatGrid8, ApplyBorders:=True _

, ApplyShading:=True, ApplyFont:=True, ApplyColor:=True, ApplyHeadingRows _

:=True, ApplyLastRow:=False, ApplyFirstColumn:=True, ApplyLastColumn:= _

False, AutoFit:=True, AutoFitBehavior:=wdAutoFitFixed

Selection.Columns.PreferredWidthType = wdPreferredWidthPoints

Selection.Columns.PreferredWidth = InchesToPoints(2)

Selection.Collapse Direction:=wdCollapseEnd

End If

Loop



setListSeparator (DefListSep)



End Sub
Aug 17 '17 #1
3 2481
Luuk
1,047 Expert 1GB
"Here is the part of the code that troubles me."

It trouble the reader here too, that's why they invented '[CODE/]' tags to make the code you posted more easy to read.

Also, please specify what error you are getting.... (for problems see a psychiatrist ;)
Aug 19 '17 #2
As gathered I am very new to programming_
the Error points to
Expand|Select|Wrap|Line Numbers
  1. setListSeparator

message is Compile error - sub or function not defined
Aug 22 '17 #3
I am also suffring with same problem.!
Aug 23 '17 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Julien - Marseille | last post by:
Hello, I need help for php syntax when i call Mysql database I have wrote that and my sql connection is working I just have a problem with this command line : $query = "SELECT * FROM...
1
by: Steve | last post by:
I just spent waaaaaaaaaaaayy too much time trying to track down an error that was incorrectly reported just now, and I would like to see if someone can explain to me why it was reported that way. ...
2
by: Dr DOOM | last post by:
Hi folks...I've just installed asp.net framework and asp.net sdk and I've cut and pasted a file from the web to test that it works. The problem is that I get this error message which says: ...
29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
3
by: Manuel | last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using devc++. So I've imported the glut32.dsp into devc++, included manually some headers, and start to compile. It return a very...
8
by: Wescotte | last post by:
The error message Parse error: syntax error, unexpected $end in FILE on line X is one I run into frequently and I know the cause is I missed an ending quote. Is there an easy way to determine...
15
by: Bjorn Jensen | last post by:
Hi! An beginner question: Pleas help me with this (-: Error (the arrow points on the s in sqrt) ===== tal.java:6: cannot find symbol symbol : method sqrt(int) location: class tal...
17
by: trose178 | last post by:
Good day all, I am working on a multi-select list box for a standard question checklist database and I am running into a syntax error in the code that I cannot seem to correct. I will also note...
3
by: James Grant | last post by:
Hi Everyone, To my understanding this code should work; however there's a syntax error somewhere within the sub-query and I cannot find it. It's very possible that my understanding is insufficient...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.