Using Application variable in Visio 2000

Started by tlpd, April 05, 2010, 11:04:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tlpd

I have a method used to reset the window size after opening as below
Sub ResetWindow()
   Dim xPos as Integer
   Dim yPos as Integer
   Dim width as Integer
   Dim win as Visio.Window
   Set win = Application.Window
   Dim hWnd as Long
   hWnd = win.WindowHandle32
   
   Dim ret as Long
   xPos = GetSystemMetrics(0)
   yPos = GetSystemMetrics(1)

   width = xPos / 2

   ret = SetWindowPos(hWnd, HWND_TOP, width - 2, 0, width + 2, yPos - 34, SWP_NOSIZE)
   
End sub


This code worked perfectly in Visio 2003, but when i executed it using Visio 2000, a [Error '438' Object Doesn't Support This Property Or Method] error was generated at [Set win = Application.Window]. The reason seems to be that [Application] variable is not recognizable or not supported in Visio 2000. So i wonder if there is a way to handle this problem.

Thank you very much in advance

Nikolay

Instead of:

   Dim win as Visio.Window
   Set win = Application.Window
   Dim hWnd as Long
   hWnd = win.WindowHandle32


Try this:

   Dim hWnd as Long
   hWnd = Application.WindowHandle32

tlpd