473,395 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Repeat code for each word document section section

4
Hi,

I am new to VB and still getting a handle on things. How do I repeat the below code for each new odd numbered page. If this requires the use of line numbers instead of paragraph numbers to set the range, remark in code.

Josha

Expand|Select|Wrap|Line Numbers
  1. Sub Test3()
  2.  
  3. Dim pChar As Variant
  4. Set myDoc = ActiveDocument
  5.  
  6. 'The following example creates a Range object beginning at the start
  7. 'of the second paragraph and ending after the third paragraph.
  8. 'The corresponding line numbers that need to be used are ln10 to ln15.
  9. 'The code must be repeated for each odd numbered page.
  10. Set myRange = myDoc.Range(Start:=myDoc.Paragraphs(2).Range.Start, _
  11.     End:=myDoc.Paragraphs(5).Range.End)
  12.  
  13.  
  14.     For Each pChar In myRange.Characters
  15.         If pChar Like "[A-Z]" Then
  16.         pChar.Select
  17.         Selection.Range.Case = wdTitleWord
  18.         End If
  19.     Next
  20.  
  21.  
  22. End Sub
Sep 11 '06 #1
0 1406

Sign in to post your reply or Sign up for a free account.

Similar topics

53
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
4
by: astro | last post by:
I've been looking at the event sinking example in Litwin et. al. "Access 97 Developer's Handbook" and I am able to event sink the 2 events listed - those being the "_quit" and "_documentchange"...
2
by: blongmire | last post by:
.... I know just enough to be dangerous, but the real danger is that I might fall asleep and hit my head on my keyboard waiting for this code to finish executing. Some preliminaries: WinXP Pro,...
0
by: .Net Newbie | last post by:
I am relatively new to .Net and have been coding an intranet site for my employer for a couple of months. I am currently stuck coding in a text-editor called EditPlus without access to the VS.Net...
2
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and call methods and set properties in MS Word to...
5
by: Mark Jerde | last post by:
Sorry if these are the wrong newsgroups -- so many to choose from! The first draft of a Word document is about 200 pages. The second draft is about 275 pages. I am required to produce a 3rd...
4
by: Tom | last post by:
Hi: I'm having a problem with a simple report in a simple database. Basically it's an issue tracking database - what is the issue, what is the proposed solution, who is responsible, a tracking...
0
gemmountain
by: gemmountain | last post by:
Hi, does anyone know how to use Word Automation to insert page numbers for each section in a Word document, and the numbering scheme of each section is independent, not the same as previous? ...
2
by: Chris | last post by:
Hello, I am trying to view a section of a Word document from with a C# 2.0 program using the following: ProcessStartInfo procInfo = new ProcessStartInfo("Word.exe"); procInfo.FileName =...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.