News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

fixing some old code

Started by perry59, March 13, 2024, 06:45:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

perry59

I am working on some old code written by someone else, may have originated in vba but I'm putting it in vb.net. there are several places generating errors and I believe I have corrected them but would like input from others.
Original fragment:

With winObj.Selection(1)
            .Cells(PX) = dblLeft + (.Cells(PX))
            .Cells(PY) = dblBottom - (.Cells(PY))
            .Name = NT
      End With


PX and PY are constants evaluating to "PinX" and "PinY", dblleft and dblbottom are floating point numbers

Here is what I have converted it to, which seems to work ok

With winObj.Selection(1)
            .Cells(PX).FormulaForceU = Convert.ToString(dblLeft + (.Cells(PX).Result(Visio.VisUnitCodes.visNoCast)))
            .Cells(PY).FormulaForceU = Convert.ToString(dblBottom - (.Cells(PY)).Result(Visio.VisUnitCodes.visNoCast)))
            .Name = NT
        End With


does this look right? is there a better way to achieve the desired results?
thanks for any tips
what, me worry?

Yacine

I usually use ResultIU (=internal units) when dealing with numbers. Don't know how visNoCast behaves.
Yacine

Browser ID: smf (is_webkit)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 164 (show)
Files included: 32 - 1207KB. (show)
Memory used: 1040KB.
Tokens: post-login.
Cache hits: 13: 0.00126s for 26,766 bytes (show)
Cache misses: 2: (show)
Queries used: 16.

[Show Queries]