Hi Sue,
i try to illustrate my problem for new:
(sorry, but my english is not so good; maybe it will helps to learn it
better if i frequently will write here in the newsgroup.
)
Well: my personalized task-form, which is into a new task-folder (not the
primary task-folder) has a button therein, what i have create.
When i click the button, a VB.NET procedure starts.
Here is the VBScript-code behind the form, which respond to the
button-click-event.
---
sub commandbutton6_click()
Dim CB5Caption
CB5Source = 1
Set MB = CreateObject("InkassiOutlookTools.WordFunction") ' this is
my VB.NET-application
call MB.Mahnbrieferstellung() 'this is a procedure in the
VB.NET-application
msgbox "OK"
CB5Source = 0
Item.Close olSave
end sub
---
So far i think my illustration is ok, right?
Here is the code of the abovementioned VB.NET-procedure:
---
Dim myOlApp As New Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim myitem As Outlook.TaskItem
Dim myitemP As Outlook.TaskItem
Dim ReminderDate As DateTime, newReminderTime As DateTime
myNamespace = myOlApp.GetNamespace("MAPI")
myitem = myNamespace.GetItemFromID(strEntryID, objStoreID)
ReminderDate = DateTime.UtcNow.AddDays(7)
newReminderTime = New System.DateTime(ReminderDate.Year,
ReminderDate.Month, ReminderDate.Day, 9, 0, 0)
myitem.UserProperties("MB1").Value = DateTime.UtcNow
myitem.UserProperties("Mahnung1").Value = True
myitem.UserProperties("aktMahnstufe").Value = "1"
myitem.Save()
Dim myPTaskFolder As Outlook.MAPIFolder =
myNamespace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks)
myitem.Move(myPTaskFolder)
Dim myFolder As Outlook.MAPIFolder
Dim myFindItem As Outlook.TaskItem
myFolder =
myNamespace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks)
myFindItem = myFolder.Items.Find("[GrID] =
'401780208129.11.20021728.02.20040-1128.69RD010173'")
myitemP = myNamespace.GetItemFromID(myFindItem.EntryID.ToString,
objStoreID)
myitemP.ReminderSet = True
myitemP.ReminderTime = newReminderTime
myitemP.Save()
Dim myPersTaskFolder As Outlook.MAPIFolder =
myNamespace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks).Folders().Item("Inkassi")
'NEW
myitemP.Move(myPersTaskFolder)
myPersTaskFolder = Nothing
myPTaskFolder = Nothing
myNamespace = Nothing
myOlApp = Nothing
---
The variable "strEntryID" comprised the "EntryID" of the taskitem, which
launches my VB.NET-procedure by click on the abovementioned button.
The procedure changes some UserProperties.values on my opened taskitem, then
it save the opened taskitem.
Then the procedure moves the item to the primary task-folder. Then the
procedure searches for the moved item in the primary task-folder.
After that it sets the value for the properties "ReminderSet" and
"ReminderTime". It saves the task-item in the primary task-folder. Then the
procedure moves the modified task-item to the original position, back in the
other task-folder.
All this works fine and in this manner the user don't receive the message
"The reminder for ... will not displayed. Are you agreed for this?".
But here the cause, which don't fall me:
when the VB.NET-procedure has finished his work and gives the control back
to VBScript-code, so all the code after this code-line
call MB.Mahnbrieferstellung() 'this is a procedure in the
VB.NET-application
didn't executed.
When i debug my VBScript-code with the Microsoft Script Editor, so i can
see, that when the VB.NET-procedure gives back the control to the VBScript
code, this opens a few new "Script-elements", and it doesn't continue at the
Script-element, from which it starts by click the button on my personalized
task-form.
Why this? I think the reason must relate to the "move-method" in the
VB.NET-code. But i would use this manner to avoid the message "The reminder
for ... will not displayed. Are you agreed for this?"
Have you a tip, how it's possible to avoid the problem with the new open of
the few "Script-elements" and how the VBScript code can continue his right
way after he achieve back the control from the VB.NET-procedure?
thx & bye
Oskar