Delete custom lists

H

Hans Knudsen

On 13 October 2006 Bob Phillips posted below code. I would like very much to
use this code but I cannot get it to work I get the error message: "Compile
error Argument not optional", and the text "DeleteCustomList" in the fifth
line from below is highlighted.

Sub DeleteLists()
Dim msg As String
Dim aryList
Dim i As Long, j As Long

For i = 1 To Application.CustomListCount
aryList = Application.GetCustomListContents(i)
msg = ""
For j = LBound(aryList) To UBound(aryList)
msg = msg & aryList(j) & vbNewLine
Next j
If MsgBox(msg & vbNewLine & vbNewLine & "Delete this list?",
vbYesNo) = vbYes Then
Application.DeleteCustomList
Application.GetCustomListNum(aryList)
End If
Next i


End Sub


Any help?

Hans Knudsen
 
J

Jim Cone

These two lines...
Application.DeleteCustomList
Application.GetCustomListNum(aryList)

Should be one line...
Application.DeleteCustomList Application.GetCustomListNum(aryList)
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Hans Knudsen"
<[email protected]>
wrote in message
On 13 October 2006 Bob Phillips posted below code. I would like very much to
use this code but I cannot get it to work I get the error message: "Compile
error Argument not optional", and the text "DeleteCustomList" in the fifth
line from below is highlighted.

Sub DeleteLists()
Dim msg As String
Dim aryList
Dim i As Long, j As Long

For i = 1 To Application.CustomListCount
aryList = Application.GetCustomListContents(i)
msg = ""
For j = LBound(aryList) To UBound(aryList)
msg = msg & aryList(j) & vbNewLine
Next j
If MsgBox(msg & vbNewLine & vbNewLine & "Delete this list?",
vbYesNo) = vbYes Then
Application.DeleteCustomList
Application.GetCustomListNum(aryList)
End If
Next i
End Sub

Any help?
Hans Knudsen
 

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