Hello,
When a file is imported (via VBA code) it is placed in center of page.
How do I import/move the objects to center of currently visible area?Thanks.
You could use ActiveWindow.ActiveView.GetViewArea to get the location and dimensions of the view area, and then reposition objects using that information. One example:
Sub center_selected_to_view() Dim dblX As Double Dim dblY As Double Dim dblW As Double Dim dblH As Double Dim sr As ShapeRange ActiveWindow.ActiveView.GetViewArea dblX, dblY, dblW, dblH Set sr = ActiveSelectionRange sr.CenterX = dblX + dblW / 2 sr.CenterY = dblY + dblH / 2 End Sub
ٗThanks for the helpful code.
I also figured out the GetViewArea method.
But instead of setting CenterX and CenterY, I was moving the object to X, Y values returned from GetViewArea.
Thanks.