How to make a VBA Code that inserts the largest sphere possible inside of a CATIA V5 model

Hello everyone
I am very new to VBA and i have no idea how to use this program
I was asked to make a macro in VBA that when the user runs it ,it will insert the largest sphere possible inside of the model the user opened
I have a bit of experience in VBA (no where near a professional at it or anything) but i do not have any idea on
how i can make this into a macro.
I have tried to do a bunch of research,even used CHATGPT to try and get a feel for the code that would be required for this but there just isn't enough information out there on the internet about CATIA V5 VBA coding.

Can anyone help me out?

Thanks for reading

1 Answer

Private Sub GetImageLayout_Click()
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.ButtonName = "Submit"
.Title = "Select an image file"
.Filters.Clear
.Filters.Add "JPEG & PNG Images Only", "*.JPG, *.PNG"

If .Show = -1 Then
Dim img As Object
Set img = Sheets("Layout").Pictures.Insert(.SelectedItems(1))

'Position Image
img.Left = 25
img.Top = 410

'Set Image Width
ActiveSheet.Pictures.ShapeRange.LockAspectRatio = msoTrue
img.Width = 500
End If

Else
MsgBox ("You Have Canceled Image insert")
End If
End With