Jonathan-LeRoux / IguanaTex

A PowerPoint add-in allowing you to insert LaTeX equations into PowerPoint presentations on Windows and Mac
http://www.jonathanleroux.org/software/iguanatex/
Other
902 stars 62 forks source link

Bug: got a overflow runtime error 6 when insert image #65

Closed wangfh5 closed 4 months ago

wangfh5 commented 5 months ago

After I upgraded to the latest macOS 15.0 beta, the "new LaTeX display" function do not work and it gets overflow runtime error 6 at the step of "insert image".

image
Jonathan-LeRoux commented 5 months ago

Thanks for reporting. Could you specify at which stage the error occurs? To do so, please check the Debug button, so that processing will stop at each step. I don't think I'll be able to debug this, but maybe @tsung-ju will have an idea.

wangfh5 commented 5 months ago

Based on the step-by-step debug mode, I passed "LaTeX to DVI" and "Cropping PDF", and then the error occurred at the step of "Insert image".

Jonathan-LeRoux commented 5 months ago

If you feel like it; could you download the .pptm, open it, trigger the bug, then click "Debug"? This should tell you which line raised the bug. Note that you will likely see 2 IguanaTex tabs, one for the loaded add-in and the other for the .pptm. If the "Debug" button is disabled as in your picture above, try the other tab. The other more involved option is to open the VBA editor (Tools>Macros>Visual Basic editor), place a breakpoint at this line by clicking in the margin, and then use the function as you've been doing. The process will stop at the line, and you then Step Over (⇧⌘O) until you hit the bug. If that's on a line calling another function, you can run again and then Step Into (⇧⌘I) when you reach that line.

wangfh5 commented 5 months ago

As you see in the figure above, the "Debug" button is in gray and can not be clicked.

I tried the breakpoint test. After many ⇧⌘O, the overflow error happened and I clicked "Debug" button (inside the VBE, it is not in gray). And then it jumped to this line: I'm not sure whether this line cause the error since it seems that clicking "Debug" button could skip the error line. Anyway, it should be a close place. And then after many ⇧⌘O, I sucessfully inserted the image.

Jonathan-LeRoux commented 5 months ago

Thanks! I'm a bit surprised you were able to insert the image in the end. Could you place the breakpoint at that line and run again? Then step over, so that we can make sure it's indeed this line that triggers the overflow. Does PowerPoint then let you continue once you hit debug?

If it's indeed that line, I'm tempted to say it's an Office bug.

wangfh5 commented 5 months ago

Yes, further testing shows that this line indeed triggers the overflow.

Does PowerPoint then let you continue once you hit debug?

Yes. After I click the "Debug" button, PowerPoint lets me continue to the next line, and then the image gets inserted.

If it's indeed that line, I'm tempted to say it's an Office bug.

I hope that Microsoft will fix it during the macOS 15.0 beta time.

Jonathan-LeRoux commented 5 months ago

Thanks a lot for your testing, I really appreciate it. Maybe one last thing you could see is what values the posX/posY input variables to the .AddPicture method are taking. I doubt they're problematic, but it's worth checking. If you could report the issue to Microsoft, that would be fantastic. There's a way to do it within PowerPoint.

In the meantime, you could try to ignore the error with something like: On Error Resume Next

The AddPicture line comes here

If Err.Number = 6 Then
    #Repeat the same AddPicture line here#
    Err.Clear
End If

Totally untested 😅

wangfh5 commented 5 months ago

Thanks for your advice. I asked ChatGPT to help me handle the overflow error and changed the function to

pasteboard-image_2024-06-16 09-41-35

Accidentally, after that, another overflow error happened before the above function call. They are just some assignment to values, so I totally do not understand why. However, I just asked ChatGPT to help me handle the error and changed it to

pasteboard-image_2024-06-16 09-47-58

These two modifications make the image insertion successful. I save the .pptm file and export it to a .ppam addin. If anyone meets the same problem, these files may be a temporary choice. IguanaTex_v1_61_wfh.zip

Jonathan-LeRoux commented 4 months ago

Given that you are the only one having reported this issue, and it's likely a Microsoft bug, I will close the issue for now without implementing the workarounds discussed above. If someone else encounters this issue, please reopen.