Using of APC.IDE.PreventShow property

I have integrated VBA 6.2 into my application. All works normal, but I have a little problem.
To prevent VBA IDE to be shown when VBA runtime error rises, I set APC.IDE.PreventShow property to True, so this successfully overrides error displaying (and stops vba code execution), but doesn't give me any sign of this (in other words I can't catch any event reporting me about the error generated by VBA). Can someone help me to handle to problem

Thanks in advance.

Ilya.


Answer this question

Using of APC.IDE.PreventShow property

  • Turnbuckle

    From the engineer:

    Thanks for your reply.
    After I read the post in detail, I have done much more researching according to the customers reply.< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 

    First of all, because the error info is thrown by VBA IDE, we have no method to get the error without the VBA IDE directly. But it doesn’t mean we have no solution for the issue.

    Here are two suggestions, and I hope they should be useful for the customer.

    ====

    1)     [you] can customize the error message.

    It means the customized error message can be thrown by your application. 

    2)  [you] wanted the  End-user to customize his  app in  his(her) own way, to write his VBA Projects and macros (just like MS Excel),i suggest [you]  use the csharp or vb.net code directly to write and run the macros. (I have a sample code in the attachment.)

    As I'm unable to attach the .zip file with the code that the engineer created, please feel free to email me at budsup@microsoft.com and I'll send it to you via email.

    Hope this helps!
    -brenda (ISV Buddy Team)

    --
    This posting is provided "AS IS" with no warranties, and confers no rights.



  • Charles55

    Hello Ilya,

    We forwarded your question to one of our internal support engineers, but they need some additional information before they can track down a solution.

    1. How [did you] set APC.IDE.PreventShow property to True; in your application or in the vba script < xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

    2. Why did [you] integrate VBA 6.2 into [your] application if [you] could, you might be better off to use [your]own code instead of the VBA script in [your]application.

    3. [you] said [you]wanted to get the error info without the VBA IDE. I don’t know what kind of error [you] mean. if the error is thrown by VBA IDE, it’s very difficult to catch it without the VBA IDE.

    Please post your replies and I'll make sure that the information gets back to the engineer.

    Thanks,
    -brenda (ISV Buddy Team)



  • Bezpol

    Hi,
    Thanks for your reply.
    Here are the answers to your questions:
    1. I'm setting PreventShow property to True from my application.
    2. I have integrated VBA into my app because I wanted my End-user to customize my app his(her) own way, to write his VBA Projects and macros (just like MS Excel). But in some situation (for some kind of users) I don't want them to see VBA IDE, even if there is an error in VBA code. So PreventShow property really prevents VBA IDE to be shown when error rises, but it simply stops VBA code execution without alerting user (maybe this is right behaviour), but I need to catch this error and show it somehow to user.
    3. Hope I explained my situation in answer 2.

    Thanks in adnavce.
    Ilya.

    P.S. I'm going to purchase VBA license from Microsoft as soon as I handle some my problems with VBA intagration.


  • Rob G

    Hi,
    Thanks for your efforts.
    1. You wrote:
    "
    [you] can customize the error message.
    It means the customized error message can be thrown by your application"
    Can you clarify how can I customize the error message and how it can be thrown by my app
    2. Now about your second suggestion: I sent you a persontal Email to the address you gave me. I'll tell you my opinion about second suggestion as soon as I receive your example.

    Thanks a lot.
    Ilya.


  • lee_connell

    FYI: this was resolved via email so I wanted to post the rest of the thread in case it's helpful to someone else.

    ***

    In my letter ,I wrote " [you] can customize the error message. It means the customized error message can be thrown by your application".

    For example ,the End-user writes a wrong macro code in your app.Though you could not catch the exception thrown by VBA IDE,you can check the variable value or use other ways to make sure the excel file is modified correctly by the macro code.When you find the macros execute result is not consistent with what you want,you can show a customize error message.

    But in fact this solution is not very effective when you could not control or predict what kind of macros the End-user will write.

    So, I suggest you use the csharp or vb.net code directly in stead of the vba script.

    So far almost all the vba script can easily be replaced by the c# code to implement the same function.

    For more information ,please visit the following Visual Studio Tools for the Microsoft Office System web site:

    http://msdn.microsoft.com/office/understanding/vsto/

    ***

    This ISV does not have vs.net and doesn’t use c#.

    Can you please provide some step-by-step instructions on how to customize an error message using VBA and how to have the VBA application throw this error message

    ***

    First,About the vs.net,I just give a example how to use vs.net to program with the office.

    If you didn't use the vs.net,you can use the relevant dev tools according your application.

    I just use vs.net as an example.

    After all, you can not get the error without the VBA IDE. And the customzied error message is not shown by VBA, but by your app.

    For example you can use <MessageBox.Show” Error vba script”> in the app when you find the End-use writes a wrong vba script.

    But, in fact the above solution is not very effective when you could not control or predict what kind of macros the End-user will write.

    So, if you can, you’d better rewrite the code in your app in stead of intergrating the VBA into your app.

    As we mentioned before,we really have no method to catch the error info when we set PreventShow property to true.

    ***

    -brenda (ISV Buddy Team)



  • Using of APC.IDE.PreventShow property