Jump to content

OutlookEX UDF - Help & Support


Recommended Posts

when running from the compiled .exe the error line is 7431, whereas when I run from within SciTe the error line is 168 or 164 depending on which folder the forwarded email needs to be moved to.

The code for these lines is:

;Move item
If $oSendToSwitch = 1 Then
  ;Move to Supplier2
  _OL_ItemMove($oOutlook, $aItems[$i][0], Default, $aFolder1[1])
  If @error <> 0 Then MsgBox(16, "Item move", "Error moving the mail item.  Check the folder 'Correct MailboxInboxInvoices sent to Supplier2" & $YearMon &"' exists. " & @error & " @extended = " & @extended)
Else
  ;Move to Supplier1
  _OL_ItemMove($oOutlook, $aItems[$i][0], Default, $aFolder2[1])
  If @error <> 0 Then MsgBox(16, "Item move", "Error moving the mail item.  Check the folder 'Correct MailboxInboxInvoices sent to Supplier1" & $YearMon &"' exists. " & @error & " @extended = " & @extended)
EndIf
Edited by mdcastle
Link to comment
Share on other sites

Strange. Line 164 and 168 are in the middle of the constants definition of the UDF. Line 7431 is somewhere outside the UDF.

Please check that the value of $i is not beyond the bounds of the array.

ConsoleWrite($i & "-" & UBound($aItems, 1))

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

But when you access $aItems[$i][0] in line

_OL_ItemMove($oOutlook, $aItems[$i][0], Default, $aFolder1[1])
$i must not be large than UBound($aItems, 1)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Correct. If you have an array with 1 data-entry and the first line is occupied by the number of rows and columns then you get 2 for UBound($array,1).

As the numbering of array elements start with 0 the first row (with the number of rows and columns) has index number 0 and the first data row has index number 1.

If you try to access row 2 you get the error you described.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I've added in some further error checking and

Global $aFolder1 = _OL_FolderAccess($oOutlook, "Correct MailboxInboxInvoices sent to Supplier2" & $YearMon, $olFolderInbox)

gives @error = 4.

I know you've said in a previous post that _OL_FolderAccess must have $iOL_FolderType set when accessing a mailbox other than the user's own - so what should $iOL_FolderType be set to if I want to access a subfolder of the Inbox, as $olFolderInbox which worked in Outlook 2007 no longer works in Outlook 2010.

Edited by mdcastle
Link to comment
Share on other sites

What's the value of $YearMon? Did you check that the folder exists?

I'm not aware of any difference between Outlook 2007 and 2010 in this case.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

the value is 2012-05 and the folder does exist. I've also tried it by specifying the folder the folder in $sOL_Folder, but this doesn't work.

I've tried the following variations:

Global $aFolder1 = _OL_FolderAccess($oOutlook, "Correct MailboxInvoices sent to Supplier2" & $YearMon, $olFolderInbox)

Global $aFolder1 = _OL_FolderAccess($oOutlook, "Correct MailboxInvoices sent to Supplier22012-05", $olFolderInbox)

Global $aFolder1 = _OL_FolderAccess($oOutlook, "Correct MailboxInboxInvoices sent to Supplier2" & $YearMon, $olFolderInbox)

Global $aFolder1 = _OL_FolderAccess($oOutlook, "Correct MailboxInboxInvoices sent to Supplier22012-05", $olFolderInbox)

Global $aFolder1 = _OL_FolderAccess($oOutlook, "Correct MailboxInvoices sent to Supplier2" & $YearMon, $olFolderInbox)

None of which work. they give either @error = 4. If I remove $olFolderInbox from the line i get @error = 1

Link to comment
Share on other sites

Did I already ask you which version of the UDF you run? 0.6.0 or 0.7.1.1?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

If you manually access the users Inbox can you see the sub-folder? Maybe it a permission problem?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Please insert the ConsoleWrite line into function _OL_FolderAccess and you will get the names of the folders/subfolders that could be accessed successfull . So the error is in the next folder level.

If $aOL_Folders[0] > 1 Then ; Access subfolders
            For $iOL_Index = 2 To $aOL_Folders[0]
                If $aOL_Folders[$iOL_Index] <> "" Then
    ConsoleWrite("Successfull: " & $oOL_Folder.folderpath & @CRLF) ; <== Display folderpath
                    $oOL_Folder = $oOL_Folder.Folders($aOL_Folders[$iOL_Index])
                    If @error Or Not IsObj($oOL_Folder) Then Return SetError($iOL_Index, @error, "")
                EndIf
            Next
        EndIf

I inserted an additional space in a subfolder an all folders up to this folder were displayed.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Thanks for all your help water.

Bizarrely

Global $aFolder1 = _OL_FolderAccess($oOutlook, "Correct MailboxInvoices sent to Supplier2" & $YearMon, $olFolderInbox)

now works. I suspect this may be problem in chair rather than computer. Sorry if I've wasted your time.

Edited by mdcastle
Link to comment
Share on other sites

Glad you got it working! It's a bit strange that you need user and user doesn't work ;)

Maybe I find some spare time to test it in the near future ...

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

@water

Update on the script to forward emails. The script isn't working again today! (I haven't made any changes since yesterday)

However, if I close Outlook 2010 down before I run the script, the script works fine, but running the script when Outlook 2010 is open throws a _OL_FolderAccess error 4.

Link to comment
Share on other sites

What? ;)

Did the script work yesterday when Outlook was already up and running?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

If you didn't change the script then it has to do with something you manually did in Outlook yesterday to make the script work when Outlook is already running.

Did you manually access the "Correct Mailbox"?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...