473,473 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Word Macro to detect a following page

AllusiveKitten
43 New Member
Hi All

Program:
Microsoft Word 2003

Back ground
I am trying to write a macro to insert a landscape page into a portrait document.

Firstly the code must find out if there is a following page after the current cursor point. If there is a following page, the code need to enter extra section breaks to ensure the footers remain correct, other wise the code will just add an extra page making it landscape.

Question:
My question is, is it possible to write code that will find out if there is a following page or not?
Oct 22 '09 #1
2 3277
Dököll
2,364 Recognized Expert Top Contributor
Hey there!

I don't have to much info on Macros, but I suspect it is possible. Let's see if the Access forum has an idea...

If you have a bit of code, post it for a quicker response:-)

In a bit!
Nov 9 '09 #2
Delerna
1,134 Recognized Expert Top Contributor
Code to get the number of pages
Expand|Select|Wrap|Line Numbers
  1. Dim varNumberPages as Variant
  2. varNumberPages = ActiveDocument.Content.Information(wdActiveEndAdjustedPageNumber)
  3.  
Code to get the current page number
Expand|Select|Wrap|Line Numbers
  1. CurPage = Selection.Information(wdActiveEndAdjustedPageNumber)
  2.  

compare current page number with number of pages
if not equal then more pages follow.

PS
I got these codes using google so I don't know if they work as is or not.
They look correct...


VBA in word..........shiver................
Nov 9 '09 #3

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

Similar topics

0
by: Sivaraman.S | last post by:
Issue: When I am opening a word document or a template from an ASP.NET Web page (language used VB.NET Visual Studio Version 2003) using Word.ApplicationClass object (Reference Word 11.0 object...
0
by: bekil | last post by:
Thanks for your suggestion Murray Jack. I also record macro while doing it manually in word then I edit the macro to see the required code. Firstly I am creating a blank page. Secondly I go to...
0
by: Sivaraman.S | last post by:
Issue : When I am trying to open a Word Document or a Template from a Web Application (ASP.NET Web page - Language Used VB.NET Visual Studio Version 2003) using Word.ApplicationClass (Refering...
5
by: Mason | last post by:
I'm having some problems converting VBA for Word 2000 to code that VB.Net understands. I recorded a macro in Word to add numbering (a. b. c.) to my paragraphs. I managed to translate quite a bit...
3
by: Anne Richmond | last post by:
The following code creates a word document. How do I add a footer to each page containing the date and page number? Dim wrdApp As Word.Application Dim wrdDoc As Word.Document Dim...
1
by: Adam Faulkner via DotNetMonster.com | last post by:
I had a problem before extracting pages from an existing word document and then inserting the content into a new word document. The following code below works with Microsoft Word 2000 Function...
1
by: ljh | last post by:
I want to develop an application that can watch for and monitor any instance of Word 2000/2003. I need to be able to write an add-in menu for Word 2000/2003 and capture all keystrokes and mouse...
6
by: Eric Layman | last post by:
Hi, I have fields from textareas. With a click of a button, php is able to grab these fields and by using header(), convert the output to Ms Word doc. But the outcome of the word doc...
6
by: nagar | last post by:
I need to get the list of Autocorrect entries in word. Is there a way to do it without connecting to Word? Is the list saved somewhere? If I need to connect to Word, how can I detect if it's...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.