Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-09-2023, 08:51 PM
Guessed's Avatar
Guessed Guessed is offline Unable to add tab stops to Word document via Excel VBA Windows 10 Unable to add tab stops to Word document via Excel VBA Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,166
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

I'm thinking you need to convert the word constants into their integer values
wdAlignTabCenter = 1
wdAlignTabRight = 2
wdTabLeaderSpaces = 0


Code:
'So try changing this line
rng.ParagraphFormat.TabStops.Add Position:=InchesToPoints(3.25), Alignment:=wdAlignTabCenter, Leader:=wdTabLeaderSpaces

'to
rng.ParagraphFormat.TabStops.Add Position:=InchesToPoints(3.25), Alignment:=1, Leader:=0
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #2  
Old 01-10-2023, 11:11 AM
scienceguy scienceguy is offline Unable to add tab stops to Word document via Excel VBA Windows 10 Unable to add tab stops to Word document via Excel VBA Office 2019
Advanced Beginner
Unable to add tab stops to Word document via Excel VBA
 
Join Date: Feb 2019
Posts: 46
scienceguy is on a distinguished road
Default

Thanks, Andrew, for the reply! I had a weird response. I ran the code as you suggested, and it worked. I closed my test file without saving and re-ran the code. This time, the code behaved as before and didn't create the tab stops. I didn't change anything. Not sure why it works sometimes and not others.

Thanks again,
Roy
Reply With Quote
Reply

Tags
excel 365, word 365



Similar Threads
Thread Thread Starter Forum Replies Last Post
Tabs in word like Excel kdawgtx Word 1 01-16-2021 08:09 PM
Word Document Restricted to using Tabs to move to next place for input swalsh96 Word 2 09-20-2016 04:41 AM
HELP: Unable to save word document SteveJ Word 0 06-28-2013 04:06 AM
Unable to select anything in an MS Word Document PaulT Word 0 08-08-2011 07:45 PM
Creating custom tabs for Word & Excel 2003 on a Windows 7 OS Skarab Office 1 07-05-2010 09:23 AM

Other Forums: Access Forums

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