Jump to content
Macro Express Forums

Recommended Posts

Hi all,

I am stuck hope someone can help me please.

This is my Macro to close a search control:

<WAIT FOR CONTROL Control="%Error1%" Option="\x06" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>
<TEXT TYPE Action="0" Text="<ENTER>"/>
<IF CONTROL Option="\x06" Variable="%Suche ergebnislos%"/>
<GET CONTROL Flags="0" Program_Name="EXCEL.EXE" Class="#32770" Title="Microsoft Excel" Control="\"OK\",\"Button\"" Variable="%Suche ergebnislos%" Caption="Microsoft Excel" Partial="FALSE" Wildcards="FALSE"/>
<SET FOCUS Control="%Suche ergebnislos%"/>
<TEXT TYPE Action="0" Text="<ESC>"/>
<TEXT TYPE Action="0" Text="<ESC>"/>
<END IF _COMMENT="1"/>
Once the control is focused it closes the Control, the problem I have got is that once the control is not displayed I get the error control does not exist.

 

No matter what I have tried I cant seem to catch that error message.

 

What would be the correct way to capture the error message "Control does not exist" please.

 

Kind regards

Hans Peter Betzler

Share this post


Link to post
Share on other sites

Hi Hans,

 

Can you provide more information please. When your code above is run, what application is active (Excel?) and what is currently focused or selected? What result do you expect and exactly what result do you get? Do we need a specific file in order to reproduce the issue?

 

Terry, UK

 

Share this post


Link to post
Share on other sites

Use the Catch Error command. In the Set Focus command you will see an "On Error" tab and the code for that error is 0x0028.

I try to avoid Catch Error commands. I think it's better to test first with If If Control > Exists.

You might also take care in how you do your Get Control command if you can see the control you want, but MEP doesn't see it. There are some technicalities one must understand in order to get this to work in some cases. The main part is MEP accesses controls by an address, and just because you see a blue 2020 Honda Civic and it looks like all the rest, the DMV sees them as distinct because they have different VINs. 

Share this post


Link to post
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...

×
×
  • Create New...