V
Vance Lee Meurer
Sorts and Finds don't work!
I created an Outlook macro that checks for an email full of data. The data
is a web pages history of user logins inserted into the body. If the email
exist the macro opens Excel, parses the text, pulls in the data and dumps it
into Excel. I only want one record per person per day to see who reads this
required web report. In Excel I would sort this by day and user (I use a
concatenated key). I sort newest to oldest. Then I check adjacent rows and
delete the duplicates.
It works but it is really slow because I cannot get Outlook to tell Excel to
do the Sort using the Excel sorting command (I also can't get it do to a
find). Instead I have to do a bubble sort manually and it takes forever.
The excel sorting function does it in a blink of an eye. Excerpts from the
code:
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")
If Err = 0 Then
Beep
Else
Set xlApp = CreateObject("Excel.Application")
End If
xlApp.Visible = True
etc etc etc
xlApp.Range("B3:x400").Select
xlApp.Selection.Sort Key1:=Range("B3"), Order1:=xlAscending,
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
I get no error but the sort does not work either. The statement is read
then the command goes off into a black hole.
Any ideas?
I created an Outlook macro that checks for an email full of data. The data
is a web pages history of user logins inserted into the body. If the email
exist the macro opens Excel, parses the text, pulls in the data and dumps it
into Excel. I only want one record per person per day to see who reads this
required web report. In Excel I would sort this by day and user (I use a
concatenated key). I sort newest to oldest. Then I check adjacent rows and
delete the duplicates.
It works but it is really slow because I cannot get Outlook to tell Excel to
do the Sort using the Excel sorting command (I also can't get it do to a
find). Instead I have to do a bubble sort manually and it takes forever.
The excel sorting function does it in a blink of an eye. Excerpts from the
code:
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")
If Err = 0 Then
Beep
Else
Set xlApp = CreateObject("Excel.Application")
End If
xlApp.Visible = True
etc etc etc
xlApp.Range("B3:x400").Select
xlApp.Selection.Sort Key1:=Range("B3"), Order1:=xlAscending,
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
I get no error but the sort does not work either. The statement is read
then the command goes off into a black hole.
Any ideas?