Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations SE2607 on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Catia V5 - CaptureToFile in VBA

Status
Not open for further replies.

kevEur

Automotive
Sep 27, 2024
3
Hello everyone,

I'm relatively new to macro programming and this forum helped me tremendously. Thanks a lot to all of you!

Now I'm at a point where I'm stuck, and I was wondering if anyone had an advice.

I have an excel macro. Purpose: when you click a button, a capture inside a Catia V5 annotation set is displayed and CaptureToFile is creating an image. This image is then added to another excel file.

The code is written in VBA and works fine: the capture is displayed correctly and the image is saved in the correct format. However, when I try to click on the image, it seems corrupted. Also checking the excel file where the image was copied into, the image cannot be displayed correctly.

When I use the same code as a Catia Macro in VBscripting, slightly adjusted ofc, the image is correctly created and can be displayed without concerns.

Before sharing any code, I was wondering if anybody had the same concern with CaptureToFile in VBA. If yes: was anyone able to fix it?

Thanks a lot in advance (p.s. if need be I can also share the code; but I suspect the concern lies in VBA vs. VBacpriting).

Cheers,
K.
 
Replies continue below

Recommended for you

Thanks for the recognition of this forum.

Never had such issue with CaptureToFile. I've just invoked it from catvba and Excel VBA, all's good.

I guess it's time to post your code.
 
Thanks for the quick reply!

I attached a portion of the code below. When I check the image in the excel file, it shows "The picture can't be displayed" next to a red cross. The image itself is created in the correct folder and has a certain size, but can also not be displayed.

In the Catia screen itself, the correct capture is displayed and the image is inserted in the correct excel sheet. I also tried different image formats and I always get the same concern.

Based on that I assumed there might have been a problem with CaptureToFile.

Thanks in advance for the additional advice.

 
 https://files.engineering.com/getfile.aspx?folder=c0f3166f-fa15-4822-95f0-869b860e8550&file=image1.png
Thanks! Indeed it solved the issue. In fact all the numbers seemed off 🤦‍♂️. Easy fix and some time wasted for such a stupid mistake.

Again thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor