Jump to content
Macro Express Forums

Don't Understand End If


terrydiz
 Share

Recommended Posts

I work with a program (OC:WebConnect) where I frequently copy and paste data from an Excel list directly into the OC:WebConnect screen. It works fine, but has many of the same qualities of a DOS program.

 

I am no coder (at all), but I have ME doing about 95% of the things I want. However, I have a particular macro that copies and pastes two items (one at a time) and returns an answer. When a particular word (PAID) pops up on screen after the first item is pasted, I want the macro to stop. Otherwise, the macro grabs the next piece of data and copies it to the wrong place and I have some additional typing to do.

 

The word "Paid" pops up in a particular area of the screen that does not populate if the macro should go farther. I tried to copy the text "Paid" to my clipboard and then doing a "If clipboard contains..." macro, but it doesn't seem to work. I placed the "End If" item directly after that macro, but the macro never stopped.

 

Where have I erred?

 

Thanks,

Terry Dismore

Lazarus Communications Group

Link to comment
Share on other sites

The End If terminates an If block like this:

If Variable %T1% does not contain "DONE"
 // <Do some
 //   macro commands
 //   here>
End If

To terminate a macro from within an If block you need to use either the Macro Return or the Macro Stop.

 

Maybe something like this would work:

If Variable %T1% does not contain "PAID"
 // <Do some
 //   macro commands
 //   here>
Else
 Macro Return
End If

Link to comment
Share on other sites

Cyberchief and Kevin;

 

Thanks for the help. What I didn't understand was that "End If" was a statement that ended the "If" branch (remember, I said I was no coder!). I thought that if the variable that I entered matched the "If" statement, it was meant to "end" the macro.

 

Your help was invaluable and I have sucessfully built a working macro for this process.

 

Thanks,

In His Grip,

Diz

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...