![]() |
#1
|
|||
|
|||
![]()
Hi All. This is my first post here.
I'm having trouble with a macro working on my home machine but not on my work machine. My home machine runs MS Office Home and Student 2013 on Windows 10 Pro v 1903. My work machine runs MS Office 365 ProPlus on Windows 10 Pro v 1909. As far as I can tell the dotm file on both machines is exactly the same. There is nothing in the Normal.dotm on both machines when I look at the Developer/Visual Basic enviroment. The Macro Security options on both machines seem to have the same settings. So now I'm beginning to think it may be an issue with an update. They were both working until a recent MS Office update at work. The macro giving me trouble follows. This macro is meant to center a form field when it is selected. That way, I don't have to use the mouse to keep the selected field in view. I'm trying to design a macro enabled test form for my company. Any advice on how to remedy or diagnose the problem would be a great help. Thanks. Public Sub SelectionScrollIntoMiddleOfView() AltS = False Dim pLeft As Long Dim pTop As Long, lTop As Long, wTop As Long Dim pWidth As Long Dim pHeight As Long, wHeight As Long Dim Direction As Integer wHeight = PixelsToPoints(ActiveWindow.Height, True) ActiveWindow.GetPoint pLeft, wTop, pWidth, pHeight, ActiveWindow ActiveWindow.GetPoint pLeft, pTop, pWidth, pHeight, Selection.Range Direction = Sgn((pTop + pHeight / 2) - (wTop + wHeight / 2)) Do While Sgn((pTop + pHeight / 2) - (wTop + wHeight / 2)) = Direction And (lTop <> pTop) ActiveWindow.SmallScroll Direction lTop = pTop ActiveWindow.GetPoint pLeft, pTop, pWidth, pHeight, Selection.Range Loop End Sub Last edited by MikeatMSOffice; 02-07-2020 at 03:05 PM. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Rod_Bowyer | Excel Programming | 7 | 10-14-2018 11:49 PM |
![]() |
johnmccrady | OneNote | 1 | 12-27-2015 09:59 PM |
![]() |
Scythe | Word | 5 | 03-04-2015 12:32 PM |
![]() |
user0044 | Project | 5 | 03-06-2012 07:28 AM |
Ctrl+Home no longer works to get me to beginning of doc. | migdaw01 | Word | 0 | 01-13-2011 12:11 PM |