Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-24-2022, 04:43 PM
exoson exoson is offline Determine Style of paragraph at current location Windows 7 64bit Determine Style of paragraph at current location Office 2010 32bit
Novice
Determine Style of paragraph at current location
 
Join Date: Jan 2014
Posts: 6
exoson is on a distinguished road
Default Determine Style of paragraph at current location

I need to use the paragraph Style at the current location to select what action I need to take.


Another VBA macro will be called based on the style.

E.g., If the Style is "Introduction" then

delete the current paragraph,


'insert some text from the clipboard

Selection.PasteAndFormat (wdFormatPlainText)


' prepare the next paragraph
Selection.Style = ActiveDocument.Styles("Body")


How do I determine the current style?
Reply With Quote
  #2  
Old 01-24-2022, 07:21 PM
Guessed's Avatar
Guessed Guessed is offline Determine Style of paragraph at current location Windows 10 Determine Style of paragraph at current location Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

This will show you the current paragraph style
Code:
Debug.Print Selection.Range.Paragraphs(1).Style
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 01-25-2022, 11:15 AM
exoson exoson is offline Determine Style of paragraph at current location Windows 10 Determine Style of paragraph at current location Office 2019
Novice
Determine Style of paragraph at current location
 
Join Date: Jan 2014
Posts: 6
exoson is on a distinguished road
Default

Thank you. I tried all kind of variations of that, but not that one.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete the current paragraph by just one click without selecting it RobertDany Word VBA 2 10-10-2021 09:55 PM
Determine Style of paragraph at current location Is there a way programmatically to determine the footnote number style, if other than arabic numbers gn4619 Word VBA 2 11-23-2015 11:00 PM
determine location of object via calculation sarahtalbot Visio 0 01-08-2015 03:27 AM
A macro that moves the current paragraph up or down? New Daddy Word VBA 2 04-13-2014 02:25 PM
Character style stripped while applying paragraph style sams_gates Word 0 08-29-2009 02:03 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:45 PM.


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