A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Outlook Script Have Pb with Do While Loop



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old September 4th 08, 12:25 PM posted to microsoft.public.outlook.program_forms
bbnimda
external usenet poster
 
Posts: 94
Default Outlook Script Have Pb with Do While Loop

Hi all

I'm using a custom Outlook form

I this form I use Do while loop, it work fine but Now I need to skip some
item that meet specific conditions so I added an if then loop end if

My working Script
===============================
Do While not (MyItem is Nothing)
Action1
Action2
Action3
loop
===============================

In my New Script I want to skip all Item that have companies name
"COMPNAME"
when I add an other loop inside the "if then" my form don't work and return
message that "do" is missing

===============================
Do While not (MyItem is Nothing)
Action1
Action2
Action3
if MyItem.companies = "COMPNAME" then
loop
end if
loop
===============================

thks for Help


Ads
  #2  
Old September 4th 08, 02:29 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Outlook Script Have Pb with Do While Loop

If you want another loop to run inside the If ... End If block, then that
needs to begin with a Do statement, just like the outer look.

If you want to perform actions only on items meeting certain criteria, then
put those actions inside an If ... ENd If block, for example:

Do While not (MyItem is Nothing)
if Not MyItem.companies = "COMPNAME" then
Action1
Action2
Action3
end if
loop
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx



"bbnimda" wrote:

Hi all

I'm using a custom Outlook form

I this form I use Do while loop, it work fine but Now I need to skip some
item that meet specific conditions so I added an if then loop end if

My working Script
===============================
Do While not (MyItem is Nothing)
Action1
Action2
Action3
loop
===============================

In my New Script I want to skip all Item that have companies name
"COMPNAME"
when I add an other loop inside the "if then" my form don't work and return
message that "do" is missing

===============================
Do While not (MyItem is Nothing)
Action1
Action2
Action3
if MyItem.companies = "COMPNAME" then
loop
end if
loop
===============================

thks for Help



  #3  
Old September 4th 08, 03:10 PM posted to microsoft.public.outlook.program_forms
bbnimda
external usenet poster
 
Posts: 94
Default Outlook Script Have Pb with Do While Loop

Hello Sue

I don't Want to perform another loop

I just want to skip item inside my "Do loop" and I can't use in fact all
my item meet more than 4 criteria and in this list I want to skip some
Item that meet 2 Criteria

after each loop I Add to a list the item and I tagg it with a specific color
to an Excel file and after each loop I go to the next line on Excel if I
ignore an item I'll
have blank line between writen lines


here a part of my code
============================
set myitem = items.find(..........)
Do while
if condition1 then
Itemcolor = 1
if condition2 then
Tagg = A
else
Tagg = B
end if
else
if THECONDITON then
HERE WHERE I WANT TO SKIP
I don't want continue with this Item and bo back to the begining
of my loop and proceed with the next item
end if
end

action1
action2
action3

Actionx = add information about the item to Excel by putting in each cell
item infomation by scrolling column
ActionZ = go to the next line in Excel
loop


I Hope I'm clear...

============================
"Sue Mosher [MVP-Outlook]" a écrit dans le message
de news: ...
If you want another loop to run inside the If ... End If block, then that
needs to begin with a Do statement, just like the outer look.

If you want to perform actions only on items meeting certain criteria,
then
put those actions inside an If ... ENd If block, for example:

Do While not (MyItem is Nothing)
if Not MyItem.companies = "COMPNAME" then
Action1
Action2
Action3
end if
loop
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx



"bbnimda" wrote:

Hi all

I'm using a custom Outlook form

I this form I use Do while loop, it work fine but Now I need to skip
some
item that meet specific conditions so I added an if then loop end if

My working Script
===============================
Do While not (MyItem is Nothing)
Action1
Action2
Action3
loop
===============================

In my New Script I want to skip all Item that have companies name
"COMPNAME"
when I add an other loop inside the "if then" my form don't work and
return
message that "do" is missing

===============================
Do While not (MyItem is Nothing)
Action1
Action2
Action3
if MyItem.companies = "COMPNAME" then
loop
end if
loop
===============================

thks for Help





  #4  
Old September 4th 08, 04:10 PM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Outlook Script Have Pb with Do While Loop

Sorry, but I can't follow your logic. It's not at all clear whether your
conditions are mutually exclusive or overlapping or what if anything Tagg and
ItemColor have to to with THECONDITION. The basic logic you need to follow is
as I gave in my previous response: Test for criteria and perform actions only
on those items meeting the criteria. (The details of the actions don't matter
at this point, BTW.) That's how you skip items in a loop that don't meet
those criteria.

Maybe instead of generalities, you could give us some specifics to work with.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx



"bbnimda" wrote:

Hello Sue

I don't Want to perform another loop

I just want to skip item inside my "Do loop" and I can't use in fact all
my item meet more than 4 criteria and in this list I want to skip some
Item that meet 2 Criteria

after each loop I Add to a list the item and I tagg it with a specific color
to an Excel file and after each loop I go to the next line on Excel if I
ignore an item I'll
have blank line between writen lines


here a part of my code
============================
set myitem = items.find(..........)
Do while
if condition1 then
Itemcolor = 1
if condition2 then
Tagg = A
else
Tagg = B
end if
else
if THECONDITON then
HERE WHERE I WANT TO SKIP
I don't want continue with this Item and bo back to the begining
of my loop and proceed with the next item
end if
end

action1
action2
action3

Actionx = add information about the item to Excel by putting in each cell
item infomation by scrolling column
ActionZ = go to the next line in Excel
loop


I Hope I'm clear...

============================
"Sue Mosher [MVP-Outlook]" a écrit dans le message
de news: ...
If you want another loop to run inside the If ... End If block, then that
needs to begin with a Do statement, just like the outer look.

If you want to perform actions only on items meeting certain criteria,
then
put those actions inside an If ... ENd If block, for example:

Do While not (MyItem is Nothing)
if Not MyItem.companies = "COMPNAME" then
Action1
Action2
Action3
end if
loop



"bbnimda" wrote:

Hi all

I'm using a custom Outlook form

I this form I use Do while loop, it work fine but Now I need to skip
some
item that meet specific conditions so I added an if then loop end if

My working Script
===============================
Do While not (MyItem is Nothing)
Action1
Action2
Action3
loop
===============================

In my New Script I want to skip all Item that have companies name
"COMPNAME"
when I add an other loop inside the "if then" my form don't work and
return
message that "do" is missing

===============================
Do While not (MyItem is Nothing)
Action1
Action2
Action3
if MyItem.companies = "COMPNAME" then
loop
end if
loop
===============================


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook stuck in process loop? PCNovice Outlook - General Queries 4 March 4th 08 05:53 PM
Endless loop of reminders in Outlook 2003 Matt Krzeminski Outlook - Calandaring 1 February 27th 08 02:43 AM
Outlook 2003 VB6 Add-In: Loop folders in AddinInstance_OnConnectio jochen[_2_] Add-ins for Outlook 2 October 30th 07 02:20 PM
Outlk 2k3 Script: Saving Excel File programticaly from OUTLOOK SCRIPT news.microsoft.com Outlook and VBA 3 November 22nd 06 04:33 PM
How to loop through Outlook tasks in VBA Rick Williams Outlook and VBA 2 January 25th 06 08:59 PM


All times are GMT +1. The time now is 11:29 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.