Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-07-2020, 11:48 AM
MikeatMSOffice MikeatMSOffice is offline Macro works at home but not at work Windows 10 Macro works at home but not at work Office 2019
Novice
Macro works at home but not at work
 
Join Date: Feb 2020
Posts: 3
MikeatMSOffice is on a distinguished road
Default Macro works at home but not at work

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.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro works at home but not at work Macro to Find and Replace Does Not Work - But Works Manually Rod_Bowyer Excel Programming 7 10-14-2018 11:49 PM
Macro works at home but not at work Using Onenote on Work and Home computers and on Android phone johnmccrady OneNote 1 12-27-2015 09:59 PM
Macro works at home but not at work Why won't up and down work like home and end anymore? Scythe Word 5 03-04-2015 12:32 PM
Macro works at home but not at work work vs regular work. and how regular work works 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

Other Forums: Access Forums

All times are GMT -7. The time now is 07:17 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft