Problem adding shape with VB .net

O

Olivier57

Hi,

I encounter strange problem adding shapes to Excel thru Vb.net standard
2008. Running thru the debugger works ok but when I launch the run time I get
try/catch error "Mscorlbib Invalid return argument". It seems that this has
to see with the processor speed as some doesn't appears when I try to add
counter (like test += 1) to try to find from where does the error come.

I will add that the soft try to add about 10 to 20 oval and after a
surrounding rectangle.

Thanks for any help,

Olivier

dim shp as excel.shape

shp = sheet.Shapes.AddShape(msosha.msoShapeOval, Xs, Ys, W, H)
shp.Select()
With shp
If fxft(x, y).occ > 2 Then
.TextFrame.Characters.Text = "x"
.TextFrame.Characters.Font.Bold = True
.TextFrame.HorizontalAlignment =
Excel.XlHAlign.xlHAlignCenter
.TextFrame.VerticalAlignment =
Excel.XlVAlign.xlVAlignCenter
.TextFrame.AutoSize = False
.TextFrame.MarginLeft = 0.0
.TextFrame.MarginRight = 0.0
.TextFrame.MarginTop = 0.0
.TextFrame.MarginBottom = 0.0
End If
.AlternativeText = "FT M:" & msk & fxft(x,
y).cat.ToString & " L : " & y.ToString & " C : " & x.ToString
.Fill.Visible =
Microsoft.Office.Core.MsoTriState.msoTrue
.Fill.Solid()
.Fill.Transparency = 0.0#
.Fill.ForeColor.SchemeColor = couleur
.Line.ForeColor.SchemeColor = 0

....

shp = sheet.Shapes.AddShape(msosha.msoShapeRectangle, Xs,
Ys, Ws, Hs)
st = Xs.ToString & "/" & Ys.ToString & "/" & Ws.ToString &
"/" & Hs.ToString
With shp
.Select()
.Fill.Visible = Microsoft.Office.Core.MsoTriState.msoFalse
.Fill.Solid()
.Fill.Transparency = 0.0
.Line.Weight = 1.0
.Line.DashStyle =
Microsoft.Office.Core.MsoLineDashStyle.msoLineSolid
.Line.Style =
Microsoft.Office.Core.MsoLineStyle.msoLineSingle
.Line.Transparency = 0.0#
.Line.Visible = Microsoft.Office.Core.MsoTriState.msoTrue
.Line.ForeColor.SchemeColor = couleur
.Line.BackColor.RGB = RGB(255, 255, 255)
.TextFrame.Characters.Text = st
.AlternativeText = st

..ZOrder(Microsoft.Office.Core.MsoZOrderCmd.msoSendToBack) '
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top