Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 12-11-2024, 10:33 AM
gmaxey gmaxey is online now Automatic form update between paragraphs Windows 10 Automatic form update between paragraphs Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,636
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Mordyas,


1.There is no such thing as a Document_SelectionChange (at least not that I'm aware of).


2. Create a new class module. Call it clsApp. In it put this code:


Code:
Option Explicit
Private WithEvents mWordApp As Word.Application
Private Sub Class_Initialize()
  Set mWordApp = Word.Application
End Sub
Private Sub mWordApp_WindowSelectionChange(ByVal oSel As Selection)
  If UserForm3.Visible Then UserForm3.UpdateSpacingBefore
End Sub

3. Create a new standard module. Call it modMain. In it, put this code:


Code:
Option Explicit
Private oCls As clsApp
Sub ShowUserForm()
  If oCls Is Nothing Then Set oCls = New clsApp
  UserForm3.Show vbModeless
 End Sub

4. In your Userform3, you can use:

Code:
Option Explicit
Private Sub UserForm_Initialize()
  UpdateSpacingBefore
End Sub
Public Sub UpdateSpacingBefore()
Dim spaceBefore As Single
  On Error Resume Next
  spaceBefore = Selection.ParagraphFormat.spaceBefore
  On Error GoTo 0
  SPB_box.Value = spaceBefore
End Sub
Private Sub SPB_updt_Click()
  UpdateSpacingBefore
End Sub

5. Turn off ChatGPT. Just my opinion.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 

Tags
auto update, paragraphs, space before



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic Update for Excel Spreadsheet Frenchy305 Excel 3 07-14-2017 12:17 PM
Automatic form update between paragraphs Stop Automatic Date-Update janetb Word 10 11-10-2016 12:05 AM
Automatic form update between paragraphs automatic insert hypens until the end of the row and in empty rows between paragraphs Ivica Word 3 12-28-2015 01:31 PM
Automatic Form update rlmoss44 Word VBA 6 12-03-2015 09:27 AM
help needed for automatic update of footer sanju71821 Word 7 07-01-2015 08:18 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:27 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