Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Query about line node positions

Status
Not open for further replies.

tecnik

Programmer
Feb 16, 2006
22
GB
Hi there,

I'm trying to put together a macro that moves line nodes, here's what I have so far:-
Code:
Sub movePoint4()
    Set Nds = Selection.ShapeRange.Nodes
    With Nds
        pointsArray = .Item(2).Points
        currXvalue = pointsArray(1, 1)
        currYvalue = pointsArray(1, 2)
        MsgBox (currXvalue & currYvalue)
        .SetPosition 2, currXvalue + 10, currYvalue + 10
    End With
End Sub
The problem I'm having is that the node in question moves, to what looks like, the position 10,10 on the page instead of adding 10 to the current xy position of the node.
I think something is wrong with currXvalue and currYvalue.

Please can anyone help?

Thanks in advance,

Nick
 

Hi,

First of all, what is Selection?

It would be much better to specify the object than use the ubiquitous Selection.

Skip,

[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue]
 


According to HELP...
[tt]
SetPosition Method


Sets the location of the node specified by Index. Note that, depending on the editing type of the node, this method may affect the position of adjacent nodes.

Syntax

expression.SetPosition(Index, X1, Y1)

expression Required. An expression that returns a ShapeNodes object.

Index Required Long. The node whose position is to be set.

X1, Y1 Required Single. The position (in points) of the new node relative to the upper-left corner of the document.
[/tt]


Skip,

[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue]
 
Hi Skip,

Thanks for the information.

Sorry, didn't explain, the selected line is the 'selection'.

In the 'Microsoft VB help' I'd found this:-
Code:
With ActiveDocument.Shapes(3).Nodes
    pointsArray = .Item(2).Points
    currXvalue = pointsArray(1, 1)
    currYvalue = pointsArray(1, 2)
    .SetPosition 2, currXvalue + 200, currYvalue + 300
End With

According to the description the example is supposed "move node two in the third shape on the active document to the right 200 points and down 300 points. The third shape must be a freeform drawing."

It doesn't mention anything about the position being relative to the top left of the page, however that's what I get and I can't understand why.

Any further ideas would be helpful.

Thanks

Nick
 


Yes, 200 points to the right of currXvalue, which is relative to the upper-left corner of the document.

Skip,

[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue]
 
Thanks Skip,

I think I've been getting my wires crossed about the coordinates being returned.

Regards

Nick
 

Take a look at the PointsToScreenPixelsX Method.

Skip,

[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue]
 
Thanks Skip, i've had a look at that.

What I'm kinda lost with is if I set the position of a node with
Code:
.SetPosition 1, 100, 100
how can I find out the positional values I have used from the node on the page?

Thanks

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top