What I meant was I thought I'd have to define more than just two or three extra styles - I thought it'd have to be two/three styles PER STYLE already defined.
This would have been a lot more work to set up (and more confusing for non-technical people to use) than either a macro'd solution...
Fumei - yeah I thought that'd be the case, but you have to ask in case someone else has sorted it!
Macropod - Thought about that, but I'd need to define more than one superscript and subscript style, as well as italics, and I just can't be bothered.
I've gone instead with hiding all the styles...
In Word 2010, it is possible to limit user to only being allowed to use a particular set of pre-defined styles. This is ideal.
However, when you apply this protection, it stops you being able to directly format the text that you do allow with such options as superscript, subscript etc. etc...
MakeItSo: As it turns out, your solution is far superior to the one I found, as Selection.ParagraphFormat.Reset and Selection.Font.Reset work on a per character basis within the selection, hence is amazingly slow!
Your last suggestion works much much faster, and therefore is the method I'd...
MakeItSo: Yeah, looking back I could have been more specific.
I say "doesn't work", and in this case I mean that the change suggested made no difference to the base functionality of the code I already had, as described in the first post.
The latest suggestion you made bears a striking...
Actually, I've had another look around, and I've sorted a way of doing it.
Posting it below in case anyone else has a similar situation they want to overcome.
Sub UpdateFormats()
' turn off screen updating and automatic repagination to speed things up a bit
Application.ScreenUpdating =...
Skip:
Tried your suggestion of
Selection.Range.Paragraphs(1).Style = MyStyle
and I'm sorry to say it didn't work. It didn't select all instances of the specified style, and actually changed the text style of the preceding paragraph to the style specified in 'MyStyle'
MakeItSo:
Tried your...
Hmm. I thought the Automatic update was supposed to filter through to update the styles based on that style...
I'll check when I get to work tomorrow and let you know...
Interesting. I'll look into it, although I'm not sure you're right, because it IS applying exactly the right formatting in the right place, but only when the cursor is on that line.
Just not sure why the cursor needs to be on the line to do it is all.
And I've deliberately set up all the...
Skip:
I'll try that tomorrow when I find some more free time to work on it, thanks.
mintjulep:
Code I'm using for the formatting is below. I'll admit, I was lazy and got it from the Macro Recorder because I couldn't be bother to type too much :)
Sub Section_Heading()
'
' Paragraph...
Hello.
I'm trying to set up a document template for generating reports. I've been through and created the layout, created all the styles etc. etc., and have been trying to set up some VBA which will reset all the styles I have defined to preset values, in case someone fiddles with everything...
Strongm - that's done it!
Thinking back, I now remember changing that so that I could actually deliberately find an error rather than have the error handler take care of it!
I've had a sleep since then, so clearly forgotten it!
Thanks.
PHV,
Thanks for the help, but unfortunately it didn't work.
Still getting the same error with it not being able to determine the folder size for no discernible reason, and still have the problem that the error-capture and -handling isn't working.
The OnError statement doesn't seem to be...
Hi all - hopefully a quick question.
I've got some code (below) that scans a specified directory for 'top level sub-folders and drops the modified date, path, number of sub-folders in each sub-folder and sub-folder size into Excel.
Sub ListTopSubFolders()
' lists information about the folders...
Ok, I have a weird problem.
I'm using MATCH() and INDEX() to dynamically generate some lookups in a table. I *thought* this was working fine, but have just comes across a weird problem and I can't work out whats wrong.
The formula I'm using is this...
Oh for... *ahem*
PHV - thanks for providing me with such a PAINFULLY obvious solution.
I did, in fact, check the references as you can see from the comments at the top of the code, but I obviously missed the MS Scripting Runtime - must have been hiding off the bottom of the list.
I am a fool...
Right, I'm bloody confused.
I have a bit of code that takes a folder path (that is either hard-coded or pulled in from a form/excel worksheet cell/wherever), and then lists all the files in that folder and in any subfolders.
Sub ListFilesInFolder(SourceFolderName As String, IncludeSubfolders...
Skip,
I already have 2 lists, as mentioned. One list sets the location, and the second list sets one of the attribute sets for that location.
8 locations (List 1) * 4 attributes per location (List 2) = 32 combinations.
All I want to do is be able to change the values in each of the lists...
Hi guys.
I've got a spreadsheet that pulls data from other sheets in the workbook depending on the values selected in 2 drop-down lists (using Data Validation -> List). One drop-down is location, and the second selects various attributes that apply to each location.
I need to be able to cycle...
Actually, sorted it now.
Used the OnTimer event with the timer interval set to 500milliseconds, and the first thing the OnTimer Event code does is set the form timer interval to zero, hence disabling any further instances of the thing running.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.