Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

text size changing when combining files

Status
Not open for further replies.

lemonhalls

Technical User
Jun 11, 2004
52
CA
I'm using the code below to merge files from one folder to just one document.

Each file to be merged has a text box at the top of the
document, in it, there are 4 lines of text with different styles and font sizes. First two lines has Arial 12, next two Arial 10 pt. Once I merge them together, the last two lines expand from 10pt to 12pt and is causing the text following to scatter around the and run into another page.

I was thinking of doing a search and replace on font style Arial size 12 to size 10, but it will also pick up the first two lines.

I also tried adding the Arial pt10 style into the after-merge document in case it doesn't pick up styles that don't exist.

How do I get all the text and format to stay exactly the same? Or is there a better approach at this?


Thanks in advance,

S

Sub mergeDoc()

'Dim activeDir As String

activeDir = InputBox _
(Prompt:="Enter the path.", Title:="Path", Default:="U:\")

With Application.FileSearch
.LookIn = activeDir 'folder with old files
End With

'move to the end of the document to insert files
Selection.EndKey Unit:=wdStory, Extend:=wdMove

With Application.FileSearch
.NewSearch
.LookIn = activeDir
.SearchSubFolders = False
.FileName = "*.doc"
.MatchTextExactly = False
If .Execute() > 0 Then

For i = 1 To .FoundFiles.Count
Selection.InsertFile FileName:=.FoundFiles(i), Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
margin
Selection.InsertBreak Type:=wdSectionBreakNextPage

Next i

'Remove Final Section Break
Selection.EndKey Unit:=wdStory
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1

End With

End Sub
 
I %!@#*&^ hate textboxes. Just hate them. I never, ever, use them. They simply are not worth the bother.

Sigh. However...you mention styles. Please be clear. Does the text, in the %!@#*&^ textbox use a formal style? Not just manually formated, but a real, named style? I am willing to bet that they do not.

If it is using a real style, does the document that is bringing it in have the exact same style?

The solution is:

1. Do not use textboxes. They are up there with badly designed pieces of Word (like Master / SubDocuments).

2. If you really use textboxes, make individual ones for each piece of text with different format - and use formal styles for each.

Because you are absolutely right. If you do a replace of the Arial 12 back to 10, well it is gonna get the 12 that you want as 12. Use Styles, and only ONE style per textbox.

hate 'em. ugh. yuk.



Gerry
 
fumei,

You're right, the text in the textboxes do not use a formal style, it is arial 12 pt and 10 pt.

here's what i tried..
I removed the textboxes and executed, still 12 pt
I removed the textboxes and changed the font style to normal (times new roman 12pt) but changed the font to 10pt and executed, still 12 pt.

>>2. If you really use textboxes, make individual ones for each piece of text with different format - and use formal styles for each.

by this, do you mean each of the four lines in the textbox should use a different style?

Why is it that adding the style into the template does not do the trick?

Thanks,

S
 
this is interesting...

I discovered that anything in the original document with text size 10pt gets converted into 12pt no matter (times new roman, arial..) what font style. (In my case, text in textboxes and text inside tables ie column headers). Other text sizes stay the same.

I did a merge and compare the original with the merged and noticed other formatting changes. It's still running into two pages. The differences include: "Normal: Font: 12pt, Allow hanging punctuation, Adjust space between Latin and Asian text, Adjust space between Asian text and numbers, Font Alignment: auto" and "Indent Left 0.3"

any other ideaS?

Thanks,

S
 
If you change the style to Normal, then change the font size...it is no longer Normal. Any, repeat, any, manual change to a formal style, changes that style. By default Word creates a new style - like Normal + Arial 10.

I removed the textboxes and executed, still 12 pt

I am not sure what that means. Removed the textboxes and executed what?

Each line that has distinct format should use a distinct style. If the format for a line is the same as another line, use the same style. If different make, and use, a separate style.

TEXTBOX CONTENT

This is Line 1 - 12 point
This is Line 2 - 12 point
This is Line 3 - 10 point
This is Line 4 - 10 point

should be:

TEXTBOX CONTENT
This is Line 1 - My12PointStyle
This is Line 2 - My12PointStyle
This is Line 3 - My10PointStyle
This is Line 4 - My10PointStyle





Gerry
 
fumei,

I mean to execute the code to merge the documents together.

Here's what I did to add the style:
format, styles and formatting, click on the word whose's style I want to add, under formatting of selected text, click modify style, change the name of the style, check off add to template.

But this added style only gets added to my template right? What if I were to use it at another computer, would it still be there?

Thanks,

S
 
here comes one of my rants.....

1. No, it would not be available on another computer. Not unless that other computer also has the template.

2. I would really like you to carefully read the following, that you wrote. This is in the context that you want to add a style. You wrote:

click modify style, change the name of the style

I am truly not being critical here. I am trying to help. What does this mean? Read it carefully.

Modify the style
Change the name of style

What did you just do? Do you think you added a new style? Did you see the button New Style? That creates a new style.

What you did was exactly what you did - modify, then rename the style. In other words, the original is gone. Yes, there is a newly named style, but it is the old one modified. This may, or may not be what you want to do. I just want you to be aware of what is happening there.

What I suggest is making a new style - call it Textbox12 - format it to your Arial 12. Please note that in the Style dialog there is a field "Based on". You may, or may not, want to be using that one. You can change it in the dialog. Care is needed because there may be format characteristics in the "Based on" style that you may not want in your new style. So look at all the format characteristics.

Then make a Textbox10 style, if needed. Whenever you need text in your textboxes to be a certain format, apply the specific styles to them.

Styles are, for some reason, a commonly under used function of Word. While a bit tricky at first, they are well, well, worth it to become familiar with. Word is, in fact, designed for them.

On a personal note. Even with large documents, I do zero formatting while I enter text. None. I do not put those extra Enter key strokes between paragraphs. I type text, I enter content. All the format work is done after, by Styles, most of which I have keyboard shortcuts for.

Back to your problem though. As you noted there was all that stuff attached to Normal:Font blah blah blah. When ever someone manually formats text, it makes a new version of the existing style. Please note the difference between manually formatting, and modifying the style.

manually format = makes new style using the existing name, with added/changed characteristics
eg. Normal style change font to Ba-Da-Boom 117 point
= NEW style "Normal:Font: 117pts; Ba-Da-Boom

modify style = changing the existing one
eg. Normal style modify font to Ba-Da-Boom 117 point
= Normal (the changes will not appear in the dropdown)

Whenever you see all that crap (Normal:blah blah blah) it is because someone manually changed stuff. It is precisely because there is non proper use of styles (likely approaching 0) that you get these issues. Solution?

How many documents are there? How much text is there? It sounds like two pagers. Frankly, I would clean up the document you want to merge INTO (the one with all the final text), and then when you grab the files and merge them in, clear format the entire incoming file. Get rid of all format, and apply proper styles to it.

I know, I know, too much work. Too much work. Unfortunately, if you really really want consistent format, it is the only way to go.

Regarding using styles on another computer. You can simply copy the template to another computer and load it in as a global template. The styles in it will become available.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top