Hello again, In VBA and in Win32::OLE perl, I have code to traverse the folders in Microsoft Outlook and to figure out which folders have unread messages.
My goal is that every folder that has unread messages should have all its parent-folders displayed in Outlook with [-]. By trial and error, I came up with the following working code in VBA -- it really works on XP, Office Outlook 2003 (11.56): Set myOlApp = CreateObject("Outlook.Application") ' Below, GetFolderVBA is a sub-routine that traverses outlook's ' folders and gets a pointer to the folder represented by ' the string fed to it Set myDestination = GetFolderVBA("Mailbox - Govindachar, Suresh/mm/foo1/the blaas/blee") ' The following MYSTERIOUS line of code ends up making all the ' parents of the associated folder be displayed with [-] !!! myOlApp.ActiveWindow (myDestination) To translate the preceding to Win32::OLE, I tried: # I first traverse all the folders and keep them # in the hash %{$ref_folder_name2pointer} # For details, see http://www.outlookcode.com/codedetail.aspx?id=803 for my $boo (keys %{$ref_folder_name2pointer}) { next unless ${$ref_folder_name2pointer}{$boo}->UnReadItemCount; print "Working to display $boo\n"; # Preceding is all OK # Next, I need to get the counter-part of # myOlApp.ActivateWindow (${$ref_folder_name2pointer}{$boo}) # But none of the following worked: # $outlook->{ActiveWindow} = ${$ref_folder_name2pointer}{$boo}; # $outlook->Explorers->Add(${$ref_folder_name2pointer}{$boo}, olFolderDisplayNormal); # $outlook->ActiveWindow({${$ref_folder_name2pointer}{$boo} => 1}); # $outlook->ActiveWindow({${$ref_folder_name2pointer}{$boo}->EntryID => 1}); # ${$ref_folder_name2pointer}{$boo}->ActiveWindow; } So: Why does "myOlApp.ActiveWindow (myDestination)" work? And how to make it work in Win32::OLE? Thanks, PS: And thanks a lot for the response to the post about setting a VBA property (Subject: Win32::OLE - Setting VBA property) --Suresh _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs