#1   Report Post  
Posted to microsoft.public.word.docmanagement
Eran Eran is offline
external usenet poster
 
Posts: 4
Default conditional macro

I have saved thousands of pages in hundreds of folders. (PhD).
have used Calibri 8 and Calibri 10.
I now have to change the Calibri 8 to Calibri 10 and the Calibri 10 to
calibri 12.
I have used this (see below) and few other varients of this macro, but to no
avail.
may somebody please suggest a solution.
many thanks
EW
p.s. "Find / replace" will not work as their are 1000's of pages.
Sub A()
'
Selection.WholeStory
With Selection.Font
If ActiveDocument.Range.Font.Size = 10 Then
ActiveDocument.Range.Font.Size = 12
Else
If ActiveDocument.Range.Font.Size = 8 Then
ActiveDocument.Range.Font.Size = 10
End If
End If
End With
ActiveDocument.Save
End Sub

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default conditional macro

If all of the paragraphs use just one font size, then you could use

Dim i As Long
With ActiveDocument
For i = 1 To .Paragraphs.Count
.Paragraphs(i).Range.Font.Size = .Paragraphs(i).Range.Font.Size + 2
Next i
End With

However, if you have different font sizes within paragraphs, you would have
to do it on a Word by Word basis using

Dim i As Long
With ActiveDocument
For i = 1 To .Words.Count
.Words(i).Font.Size = .Words(i).Font.Size + 2
Next i
End With

If you moved all of the files into one folder, you could incorporate the
relevant of the above pieces of code into a modification of the code in the
article "Find & ReplaceAll on a batch of documents in the same folder" at:

http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm

to process all of the documents in one go.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Eran" wrote in message
...
I have saved thousands of pages in hundreds of folders. (PhD).
have used Calibri 8 and Calibri 10.
I now have to change the Calibri 8 to Calibri 10 and the Calibri 10 to
calibri 12.
I have used this (see below) and few other varients of this macro, but to
no
avail.
may somebody please suggest a solution.
many thanks
EW
p.s. "Find / replace" will not work as their are 1000's of pages.
Sub A()
'
Selection.WholeStory
With Selection.Font
If ActiveDocument.Range.Font.Size = 10 Then
ActiveDocument.Range.Font.Size = 12
Else
If ActiveDocument.Range.Font.Size = 8 Then
ActiveDocument.Range.Font.Size = 10
End If
End If
End With
ActiveDocument.Save
End Sub



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default conditional macro

I would test this on COPIES of your files, but maybe something like

Sub ChangeFontSize()
Dim rFont As Range
Dim vOldSize As Variant
Dim vNewSize As Variant
Dim i As Long
vOldSize = Array(10, 8, 10.5, 12.5)
vNewSize = Array(12.5, 10.5, 10, 12)
For i = 0 To UBound(vOldSize)
Selection.HomeKey wdStory
With Selection.Find
.Font.Size = vOldSize(i)
Do While .Execute(Forward:=True) = True
Set rFont = Selection.Range
rFont.Font.Size = vNewSize(i)
Selection.Collapse wdCollapseEnd
Loop
End With
Next i
End Sub

If you wish to batch process a while folder full of documents then

Sub ChangeFontSize()
Dim strFile As String
Dim strPath As String
Dim oDoc As Document
Dim rFont As Range
Dim vOldSize As Variant
Dim vNewSize As Variant
Dim i As Long
Dim fDialog As FileDialog

vOldSize = Array(10, 8, 10.5, 12.5)
vNewSize = Array(12.5, 10.5, 10, 12)
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select Folder containing the documents to be modifed and
click"
OK ""
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show -1 Then
MsgBox "Cancelled By User"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) "\" Then strPath = strPath + "\"
End With

If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
strFile = Dir$(strPath & "*.do?")

While strFile ""
Set oDoc = Documents.Open(strPath & strFile)
For i = 0 To UBound(vOldSize)
Selection.HomeKey wdStory
With Selection.Find
.Font.Size = vOldSize(i)
Do While .Execute(Forward:=True) = True
Set rFont = Selection.Range
rFont.Font.Size = vNewSize(i)
Selection.Collapse wdCollapseEnd
Loop
End With
Next i
oDoc.Close SaveChanges:=wdSaveChanges
strFile = Dir$()
Wend
End Sub

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Eran wrote:
I have saved thousands of pages in hundreds of folders. (PhD).
have used Calibri 8 and Calibri 10.
I now have to change the Calibri 8 to Calibri 10 and the Calibri 10 to
calibri 12.
I have used this (see below) and few other varients of this macro,
but to no avail.
may somebody please suggest a solution.
many thanks
EW
p.s. "Find / replace" will not work as their are 1000's of pages.
Sub A()
'
Selection.WholeStory
With Selection.Font
If ActiveDocument.Range.Font.Size = 10 Then
ActiveDocument.Range.Font.Size = 12
Else
If ActiveDocument.Range.Font.Size = 8 Then
ActiveDocument.Range.Font.Size = 10
End If
End If
End With
ActiveDocument.Save
End Sub



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
[email protected] dipperoo@googlemail.com is offline
external usenet poster
 
Posts: 2
Default conditional macro

Hi Doug
Would this work with percentages? i.e.:-
.Paragraphs(i).Range.Font.Size = .Paragraphs(i).Range.Font.Size +
5%
or
.Paragraphs(i).Range.Font.Size = .Paragraphs(i).Range.Font.Size
105%
???
Thanks
Phil (trying to keep my colleagues happy with nice buttons)


On 23 Jan, 06:48, "Doug Robbins - Word MVP"
wrote:
If all of the paragraphs use just one font size, then you could use

Dim i As Long
With ActiveDocument
* * For i = 1 To .Paragraphs.Count
* * * * .Paragraphs(i).Range.Font.Size = .Paragraphs(i).Range.Font.Size + 2
* * Next i
End With

However, if you have different font sizes within paragraphs, you would have
to do it on a Word by Word basis using

Dim i As Long
With ActiveDocument
* * For i = 1 To .Words.Count
* * * * .Words(i).Font.Size = .Words(i).Font.Size + 2
* * Next i
End With

If you moved all of the files into one folder, you could incorporate the
relevant of the above pieces of code into a modification of the code in the
article "Find & ReplaceAll on a batch of documents in the same folder" at:

http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm

to process all of the documents in one go.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Eran" wrote in message

...

I have saved thousands of pages in hundreds of folders. (PhD).
have used Calibri 8 and Calibri 10.
I now have to change the Calibri 8 to Calibri 10 and the Calibri 10 to
calibri 12.
I have used this (see below) and few other varients of this macro, but to
no
avail.
may somebody please suggest a solution.
many thanks
EW
p.s. "Find / replace" will not work as their are 1000's of pages.
Sub A()
'
* *Selection.WholeStory
* *With Selection.Font
* * * * * *If ActiveDocument.Range.Font.Size = 10 Then
* * * * * * * *ActiveDocument.Range.Font.Size = 12
* * * * * * * *Else
* * * * * * If ActiveDocument.Range.Font.Size = 8 Then
* * * * * * * *ActiveDocument.Range.Font.Size = 10
End If
End If
End With
ActiveDocument.Save
End Sub


  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP on news.microsoft.com Doug Robbins - Word MVP on news.microsoft.com is offline
external usenet poster
 
Posts: 407
Default conditional macro

Use

.Paragraphs(i).Range.Font.Size = .Paragraphs(i).Range.Font.Size * 1.05


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

wrote in message
...
Hi Doug
Would this work with percentages? i.e.:-
.Paragraphs(i).Range.Font.Size = .Paragraphs(i).Range.Font.Size +
5%
or
.Paragraphs(i).Range.Font.Size = .Paragraphs(i).Range.Font.Size
105%
???
Thanks
Phil (trying to keep my colleagues happy with nice buttons)


On 23 Jan, 06:48, "Doug Robbins - Word MVP"
wrote:
If all of the paragraphs use just one font size, then you could use

Dim i As Long
With ActiveDocument
For i = 1 To .Paragraphs.Count
.Paragraphs(i).Range.Font.Size = .Paragraphs(i).Range.Font.Size + 2
Next i
End With

However, if you have different font sizes within paragraphs, you would
have
to do it on a Word by Word basis using

Dim i As Long
With ActiveDocument
For i = 1 To .Words.Count
.Words(i).Font.Size = .Words(i).Font.Size + 2
Next i
End With

If you moved all of the files into one folder, you could incorporate the
relevant of the above pieces of code into a modification of the code in
the
article "Find & ReplaceAll on a batch of documents in the same folder" at:

http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm

to process all of the documents in one go.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Eran" wrote in message

...

I have saved thousands of pages in hundreds of folders. (PhD).
have used Calibri 8 and Calibri 10.
I now have to change the Calibri 8 to Calibri 10 and the Calibri 10 to
calibri 12.
I have used this (see below) and few other varients of this macro, but
to
no
avail.
may somebody please suggest a solution.
many thanks
EW
p.s. "Find / replace" will not work as their are 1000's of pages.
Sub A()
'
Selection.WholeStory
With Selection.Font
If ActiveDocument.Range.Font.Size = 10 Then
ActiveDocument.Range.Font.Size = 12
Else
If ActiveDocument.Range.Font.Size = 8 Then
ActiveDocument.Range.Font.Size = 10
End If
End If
End With
ActiveDocument.Save
End Sub





  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP on news.microsoft.com Doug Robbins - Word MVP on news.microsoft.com is offline
external usenet poster
 
Posts: 407
Default conditional macro

Use

.Paragraphs(i).Range.Font.Size = .Paragraphs(i).Range.Font.Size * 1.05


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

wrote in message
...
Hi Doug
Would this work with percentages? i.e.:-
.Paragraphs(i).Range.Font.Size = .Paragraphs(i).Range.Font.Size +
5%
or
.Paragraphs(i).Range.Font.Size = .Paragraphs(i).Range.Font.Size
105%
???
Thanks
Phil (trying to keep my colleagues happy with nice buttons)


On 23 Jan, 06:48, "Doug Robbins - Word MVP"
wrote:
If all of the paragraphs use just one font size, then you could use

Dim i As Long
With ActiveDocument
For i = 1 To .Paragraphs.Count
.Paragraphs(i).Range.Font.Size = .Paragraphs(i).Range.Font.Size + 2
Next i
End With

However, if you have different font sizes within paragraphs, you would
have
to do it on a Word by Word basis using

Dim i As Long
With ActiveDocument
For i = 1 To .Words.Count
.Words(i).Font.Size = .Words(i).Font.Size + 2
Next i
End With

If you moved all of the files into one folder, you could incorporate the
relevant of the above pieces of code into a modification of the code in
the
article "Find & ReplaceAll on a batch of documents in the same folder" at:

http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm

to process all of the documents in one go.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Eran" wrote in message

...

I have saved thousands of pages in hundreds of folders. (PhD).
have used Calibri 8 and Calibri 10.
I now have to change the Calibri 8 to Calibri 10 and the Calibri 10 to
calibri 12.
I have used this (see below) and few other varients of this macro, but
to
no
avail.
may somebody please suggest a solution.
many thanks
EW
p.s. "Find / replace" will not work as their are 1000's of pages.
Sub A()
'
Selection.WholeStory
With Selection.Font
If ActiveDocument.Range.Font.Size = 10 Then
ActiveDocument.Range.Font.Size = 12
Else
If ActiveDocument.Range.Font.Size = 8 Then
ActiveDocument.Range.Font.Size = 10
End If
End If
End With
ActiveDocument.Save
End Sub



  #7   Report Post  
Posted to microsoft.public.word.docmanagement
[email protected] dipperoo@googlemail.com is offline
external usenet poster
 
Posts: 2
Default conditional macro

On 4 Mar, 08:09, "Doug Robbins - Word MVP on news.microsoft.com"
wrote:
Use

*.Paragraphs(i).Range.Font.Size = .Paragraphs(i).Range.Font.Size * 1.05

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

wrote in message

...
Hi Doug
Would this work with percentages? i.e.:-
* * *.Paragraphs(i).Range.Font.Size = .Paragraphs(i).Range.Font.Size +
5%
or
* * *.Paragraphs(i).Range.Font.Size = .Paragraphs(i).Range.Font.Size
105%
???
Thanks
Phil (trying to keep my colleagues happy with nice buttons)

On 23 Jan, 06:48, "Doug Robbins - Word MVP"
wrote:

If all of the paragraphs use just one font size, then you could use


Dim i As Long
With ActiveDocument
For i = 1 To .Paragraphs.Count
.Paragraphs(i).Range.Font.Size = .Paragraphs(i).Range.Font.Size + 2
Next i
End With


However, if you have different font sizes within paragraphs, you would
have
to do it on a Word by Word basis using


Dim i As Long
With ActiveDocument
For i = 1 To .Words.Count
.Words(i).Font.Size = .Words(i).Font.Size + 2
Next i
End With


If you moved all of the files into one folder, you could incorporate the
relevant of the above pieces of code into a modification of the code in
the
article "Find & ReplaceAll on a batch of documents in the same folder" at:


http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm


to process all of the documents in one go.


--
Hope this helps.


Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.


Doug Robbins - Word MVP


"Eran" wrote in message


...


I have saved thousands of pages in hundreds of folders. (PhD).
have used Calibri 8 and Calibri 10.
I now have to change the Calibri 8 to Calibri 10 and the Calibri 10 to
calibri 12.
I have used this (see below) and few other varients of this macro, but
to
no
avail.
may somebody please suggest a solution.
many thanks
EW
p.s. "Find / replace" will not work as their are 1000's of pages.
Sub A()
'
Selection.WholeStory
With Selection.Font
If ActiveDocument.Range.Font.Size = 10 Then
ActiveDocument.Range.Font.Size = 12
Else
If ActiveDocument.Range.Font.Size = 8 Then
ActiveDocument.Range.Font.Size = 10
End If
End If
End With
ActiveDocument.Save
End Sub


Thanks for that, most helpful.
Phil
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Formating Daedalus1 Tables 1 December 5th 08 03:07 AM
Spell Check a protected Form with a Macro & already have forms picture macro [email protected] Microsoft Word Help 2 October 25th 07 04:11 PM
Pause an executing Word Macro to enter info and then Macro continu strongwell Microsoft Word Help 1 August 11th 06 06:57 PM
conditional footer Hopeful in NH Microsoft Word Help 3 June 29th 06 06:11 AM
Conditional Slash Similar to Conditional Hyphen? Oliver St Quintin Page Layout 7 May 10th 05 09:41 PM


All times are GMT +1. The time now is 02:58 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"