Macro Help needed.

D

Don Schmidt

I have never created a macro before and need some help.

I have a Word 97 file that is a Directory of individuals, their Lodge,
e-mail address and a flag symbol in four columns of a table.

Column 1 are the names of individuals
Column 2 is their lodge (Names of cities)
Column 3 is their e-mail address
Column 4 is a flag image

I would like to be able to sort by any of the first three columns in
ascending order and the flag column in descending order. (some individuals
will have flags and the others will have a blank cell.

My goal is to be able to enter Alt+N (names), Alt+L (lodges), Alt+E and
Alt+F and have the list sort to these respective results.


I've tried several time to auto write the macro but his ol soul is doing
something very wrong for when I attempt to run a macro I get an error
report.

Help please.
 
J

Jonathan West

Hi Don,

You don't actually need a macro for this. provided you have put the
information into a table, you can sort the individual columns of the table
by going to Table, Sort, and using the dialog that appears.

However, if that doesn't do what you need, I'll need to see a bit more
information, such as the relevant parts of the code, which line of code the
error occurs on, and exactly what the error message is.

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
D

Don Schmidt

Thanks Jonathan for responding.

When I attempt running the macro I get the following:

Runtime error 9125
String passed can't be parsed

I click Debug

Window pops up with the following:

Sub Sort_Lodges()
'
' Sort_Lodges Macro
' Macro recorded 11/25/05 by Don Schmdit
'
Selection.Sort ExcludeHeader:=False, FieldNumber:="Column 2", _
SortFieldType:=wdSortFieldAlphanumeric,
SortOrder:=wdSortOrderAscending, _
FieldNumber2:="", SortFieldType2:=wdSortFieldAlphanumeric,
SortOrder2:= _
wdSortOrderAscending, FieldNumber3:="", SortFieldType3:= _
wdSortFieldAlphanumeric, SortOrder3:=wdSortOrderAscending,
Separator:= _
wdSortSeparateByTabs, SortColumn:=False, CaseSensitive:=False,
LanguageID _
:=wdLanguageNone
End Sub

Does this help?

Don





Jonathan West said:
Hi Don,

You don't actually need a macro for this. provided you have put the
information into a table, you can sort the individual columns of the table
by going to Table, Sort, and using the dialog that appears.

However, if that doesn't do what you need, I'll need to see a bit more
information, such as the relevant parts of the code, which line of code
the error occurs on, and exactly what the error message is.

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
J

Jonathan West

Does it work if you cut the macro down to just this?

Sub Sort_Lodges()
'
' Sort_Lodges Macro
' Macro recorded 11/25/05 by Don Schmdit
'
Selection.Sort ExcludeHeader:=False, FieldNumber:="Column 2", _
SortFieldType:=wdSortFieldAlphanumeric,
SortOrder:=wdSortOrderAscending
End Sub

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org


Don Schmidt said:
Thanks Jonathan for responding.

When I attempt running the macro I get the following:

Runtime error 9125
String passed can't be parsed

I click Debug

Window pops up with the following:

Sub Sort_Lodges()
'
' Sort_Lodges Macro
' Macro recorded 11/25/05 by Don Schmdit
'
Selection.Sort ExcludeHeader:=False, FieldNumber:="Column 2", _
SortFieldType:=wdSortFieldAlphanumeric,
SortOrder:=wdSortOrderAscending, _
FieldNumber2:="", SortFieldType2:=wdSortFieldAlphanumeric,
SortOrder2:= _
wdSortOrderAscending, FieldNumber3:="", SortFieldType3:= _
wdSortFieldAlphanumeric, SortOrder3:=wdSortOrderAscending,
Separator:= _
wdSortSeparateByTabs, SortColumn:=False, CaseSensitive:=False,
LanguageID _
:=wdLanguageNone
End Sub

Does this help?

Don
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top