Given that the cursor is within some TextRange tr, I would like a Sub that takes tr as an input argument and selects (or returns) a TextRange that starts at the start of the current line containing tr.startand ends at the next instance of a "." or ":"). Ideally this would work with an arbitrary TextRange or with the current selection (ActiveWindow.Selection.TextRange). NOTE: it maybe be that tr.Length = 0 (nothing actually selected).
Set TextRange to start at beginning of current line (PowerPoint 2007 VBA)
431 Views Asked by R. Hoffman At
1
There are 1 best solutions below
Related Questions in VBA
- Toggle "conversation view" in Outlook with VBA
- VBA query - sort text in alphabetical order in Word
- Excel - Visual Basic, macro with autofill "1"
- Getting Run-time error '13': Type Mismatch using .Find
- Getting website metadata (Excel VBA/Python)
- How to use VBA to bold just some text
- VBA Code to filter and get values from csv to excel worksheet
- Azure Batch for Excel VBA
- How can i printpreview multiple excel sheets, with the names of the sheets located in a range?
- Comparison the data of two row and unique number highlight and show below of it
- Is there a way to pass Today's date as a command line argument to Excel from a Windows Task Scheduler Job
- Xero Upload Invoice file using API
- Visual Basic For Application Related Question
- Trying to give color to column field headers in pivot table with vba
- General error handler: If any error in UserForm other than msgBox: Err.Description
Related Questions in POWERPOINT
- Microsoft Office 365 problem cannot open a blank excel document
- Limit object movement to one axis only in Powerpoint
- How to convert a PPTX file to PDF using Python without depending on Windows (For Linux)
- SSRS report exporting as PPT file
- Difficulty Embedding Fonts in PowerPoint Slides via insertSlidesFromBase64 Method
- When I click "enable macros" on my PowerPoint presentation, I get an error saying controls can't be activated. They're not registered on this computer
- Is there a way of assigning subscripts/superscripts as shown below?
- VB code to set two color gradient in PowerPoint cell table
- How can I copy a date from excel to powerpoint through vba and forcing english format regardless of local formatting?
- Is there a way to have a working drop-down list in a table from a slide in a PowerPoint file that is being displayed in MS Teams?
- Edit Excel Cell with ActiveX
- VBA pasting from Excel to PowerPoint has stopped working
- Link shape size and position to a text table dynamic content
- VBA PowerPoint Run-time error '-2147467259' (80004005): Presentation.Close: Failed
- python pptx not extracting all the text
Related Questions in POWERPOINT-2007
- Is there a way to ungroup grouped images within the PowerPoint slide using Python?
- Creating 3D tables in Powerpoint
- Trigger Animation in PowerPoint
- PHPPowerpoint live object Issue
- Set TextRange to start at beginning of current line (PowerPoint 2007 VBA)
- Why does Shapes.Item return 0x8004005 error on PowerPoint 2007?
- Formula added to embedded chart in Powerpoint with VBA is referencing wrong cells
- Refresh an EmbeddedOLEObject Excel.Sheet.8 in Powerpoint 2007
- Select Shape on SlideMaster in PowerPoint 2007
- Power Point Event
- Positioning images on slides in PowerPoint 2007 using vba
- Login scripts - Powerpoint
- HRESULT: 0x800A03EC and PowerPoint -- or -- Better Way to Edit a Chart?
- How to activate (make visible / enable / show) Selection Pane in PowerPoint using VBA?
- Changing the properties of elements in Office Ribbon using VBA
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I've answered the question by implementing a loop through all paragraphs in the text frame to find the paragraph containing the cursor, then through the lines in that paragraph to find the line containing the cursor. Then selecting text in the line starting at the first character and extending until the first of a ".", ":" or the end of the line. Then applying the "style" to the selected text. That code is below (some comments follow the code).
I am still hoping for a more elegant solution that doesn't require searching.
Three comments on the code:
Exit For, and then, for such exits, only immediately following theThen, which is the reason for not having a block follow theThen.