how to show shape through VBS?

The line:

.Shape("Sheet.1").XYToPage 0, 0, X, Y

should be:

.Shapes("Sheet.1").XYToPage 0, 0, X, Y

July 15th, 2013 9:13am

Hello, there is a code on VBS which opens the "shem.vsd" file, opens a certain sheet "list-2" and it is necessary that showed "sheet.1" figure. While the code reaches a line #22 ".Shape ("Sheet.1") of.XYToPage 0, 0, X, Y" with an error "Object doesn't maintain this property or a method: 'Shape'"
P.S. Visio of 2010 Premiums, Windows 7 x86

Dim oFSO, vsApp, sFile
    Dim X, Y
    sFile = "C:\Temp\shem.vsd"
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    Set WshShell = CreateObject("WScript.Shell")
        If Not oFSO.FileExists(sFile) Then
        MsgBox "FILE NOT FOUND", 48, "ERROR"
        End If
    On Error Resume Next
    Set vsApp = GetObject(, "Visio.Application")
        If vsApp Is Nothing Then Set vsApp = WScript.CreateObject("Visio.Application")
        With vsApp
        On error goto 0
            .Visible = True
            WshShell.AppActivate "Microsoft Visio"
            With .Application
                .Documents.OpenEx "C:\Temp\shem.vsd", 32
                .ActiveWindow.Page = .ActiveDocument.Pages("list-2")
            End With
                With .ActiveDocument.Pages("list-2")
                    vsApp.Application.ActiveWindow.Zoom = 1
                    .Shapes("Sheet.1").XYToPage 0, 0, X, Y
                End With
            With .ActiveWindow
            .ScrollViewTo X, Y
            .Select .Page.Shapes("Sheet.1"), 2
            End With
        End With
Set oFSO = Nothing

Such question, whether it is possible to show a certain figure (which already is in the file on a certain leaf) means of VBS? Because through a macro everything perfectly turns out, the script which can start third-party application is necessary. Thanks in advance



Free Windows Admin Tool Kit Click here and download it now
July 15th, 2013 12:47pm

The line:

.Shape("Sheet.1").XYToPage 0, 0, X, Y

should be:

.Shapes("Sheet.1").XYToPage 0, 0, X, Y		
July 16th, 2013 2:32am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics