Determine the page number in Word VBA

So... Long story short I'm trying to bypass the 65536 row problem in Excel by 
opening the file in Word and cutting it into smaller pieces.
Then I can keep track of the smaller pieces naming the file (Filename1, 
filename2) and so on and open them in Excel, format them, remove all the junk 
I don't want and put all the junk I do want on a single sheet.

When I open the document in Word I can jump to page 575 and cut up, move 
that in a new document and save the file name.
The problem is I can't close the loop yet. If I could determine of the last 
page is greater than 575 I could say something like "Do until LastPageNumber 
< 575" and exit the loop.
As it is now it just copies the last page over and over again.

So how do I determine the last page in the document and stick it in a 
variable?


Thanks!


0
Utf
4/19/2010 7:00:01 AM
word.vba.general 1023 articles. 1 followers. Follow

1 Replies
1443 Views

Similar Articles

[PageSpeed] 9

Use  ActiveDocument.BuiltInDocumentProperties(wdPropertyPages)

-- 
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

"sourceAK" <sourceAK@discussions.microsoft.com> wrote in message 
news:4B6476B6-6468-4FDD-BAE0-A46ABD293FFF@microsoft.com...
> So... Long story short I'm trying to bypass the 65536 row problem in Excel 
> by
> opening the file in Word and cutting it into smaller pieces.
> Then I can keep track of the smaller pieces naming the file (Filename1,
> filename2) and so on and open them in Excel, format them, remove all the 
> junk
> I don't want and put all the junk I do want on a single sheet.
>
> When I open the document in Word I can jump to page 575 and cut up, move
> that in a new document and save the file name.
> The problem is I can't close the loop yet. If I could determine of the 
> last
> page is greater than 575 I could say something like "Do until 
> LastPageNumber
> < 575" and exit the loop.
> As it is now it just copies the last page over and over again.
>
> So how do I determine the last page in the document and stick it in a
> variable?
>
>
> Thanks!
>
> 
0
Doug
4/19/2010 7:14:33 AM
Reply:

Similar Artilces:

Excel, how do I change the column headings from letters to number
I have a spreadsheet that has numbered columns as opposed to the standard letters. How can I change this back to letters? Go to the Tools menu, choose Options, then the General tab. There, uncheck the R1C1 reference style setting. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "lazybee" <lazybee@discussions.microsoft.com> wrote in message news:030962A3-A111-4780-93C0-1D28003F1F20@microsoft.com... >I have a spreadsheet that has numbered columns as opposed to the >standard > letters. How can I change this ...

How do I freeze or lock cells to show up on each page without typ.
I have a 4 page sheet. I have a header already. But I want to freeze the cells that head up the first page. I've done it before in school but can't remember what it is called or how to do it...that's why I'm doing this. Anyway, I want these cells to print off on each new page without having to type them on each page. I hope that makes sense and I hope that someone can help me! If you mean for printing do file>page setup>sheet and select rows to repeat at top otherwise for viewing you can select a2 if the headers start in row 1 and do window> freeze panes ...

converting tabular structures in a Word document into an actual table or reading data from the tabular structures using VBA code
I have a macro which can read the last cell/column of all tables in a Word 2003/2007 document and store the data in an MS-Access table. But, some Word documents have the data in structures like a table format but are not actually tables. The structure looks like a table, but the table borders are actually line connectors. These documents were created by a software(VeryPDF PDF to Word converter) which converted the PDF documents(the original format these documents were) into Word documents. 1. Is there a way I can convert/replace the tabular structures with actual tables in Word so t...

VLookup in VBA giving error message
Hi, I'm having trouble making the vlookup function work in VBA. the values that are used are all dates, I don't know if that makes a difference. Worksheets("sheet1").range("a1").value = application.WorksheetFunction. _ Vlookup(Range("c1"), range("a:a"), 2) this gives me a run-time error '1004' Unable to get the vlookup property of the Worksheet function class so i tried this: Worksheets("sheet1").range("a1").value = application.Vlookup(Range("c1"), _ range("a:a"), 2) but this gives me a #REF ...

How do I convert a word table into an excel document?
I have managed to get the info accross no problem but the formatting is all over the place. For instance - 07/10 meaning July 2010 is appearing as 07/Oct despite me going into format cells custom then enter mm/yy which has always worked previously. Any ideas? You can't use it like that regardless of formatting, you need to put in the whole date or else Excel will always assume the current year so any real date used for calculations needs to be numeric and needs a day, so you can enter (assuming US date format) 07/01/10 and use a custom format of mm/yy or if you don't need it for...

copy does not work in word 2003
I can't seem to copy from word 2003. I select text but it won't take it. I can copy from an e-mail and paste into word, but word doesn't seem to want to copy, either from one word document to another or into my e-mail. It's been working fine for almost four years, it just acted up. Any suggestions? The usual reason is some third party add-in that is messing with the Office clipboard. If you start Word in Safe Mode, can you copy/paste normally then? From Start | Run (Winkey+R), type in winword /a and press Enter. Word will start in Safe Mode. Open two doc...

Investment Summary on Home Page
This is a multi-part message in MIME format. ------=_NextPart_000_0039_01C4EF37.6BEB29B0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Okay, I have had investments that I have sold completely within an = account and purchased other investments. When I go to "My Money" home = page, it will still show the old investment under the "Investment = Summary", "Investment Performance" and "Best and Worst Performance" = sections, along with the new investments. How can I clear out the old = investments from...

Page up and Page down
Is there any way the you can use Code to cause a form to do page up and page down. I have a Long form that some of the information that is at the bottom of the form is out of view and only use by certain people. How can I have a botton on click go page down to the bottom and another button that will return the form to the top of the form. I know that you can use the keys to accomplish this but for appearance value I would rather use a button on the form to accomplish this. any ideas? Sandrao, You can put a Page Break control on your form. Then, code on the Click event of your button...

copying formulas in vba
Hey guys. I was wondering if someone could help me. I am writing a vba script that takes in data, analyzes it, and then copies the results to a new file. I am having a problem with two things. 1) I am using a template for the new file so there are a lot of formulas (sums and std) already defined and ready to use. However, there are some instances where there is a random amount of additional data I have to put in. So, I have to apply the same formulas to this new data. How do I copy formulas from one cell to another (allowing for a change in row) in vba? Lets say cell(1,4) has the form...

How do I print 4 postcards to one page to match my postcard paper
I bought perforated postcard paper that has 4 postcards per sheet. How do I create that in Publisher? I created it exactly how I want it to look and then realized it's only printing 2 per page. Thanks, Lauren Which version of Publisher are you using? -- JoAnn Paules MVP Microsoft [Publisher] ~~~~~ How to ask a question http://support.microsoft.com/KB/555375 "Lauren" <Lauren@discussions.microsoft.com> wrote in message news:DDA6778A-5DF0-4278-A1CA-896DC49FAFBA@microsoft.com... >I bought perforated postcard paper that has 4 postcards per sheet. How do >...

using vba so search multiple Sheets
i'm trying to search across multiple sheets based on data submitted via an input box. So essentially, you click the button, a box appears, you type what your looking for and if it finds it, it'll select it otherwise a error message appeats. i found the below code, but it only works if the cell with the value in it is active (i.e. i've clicked on it). Code: Dim datatoFind Dim sheetCount As Integer Dim counter As Integer Dim currentSheet As Integer On Error Resume Next currentSheet = ActiveSheet.Index datatoFind = InputBox("Please enter the value to search...

How many pages can a booklet have?
Hi how many pages can a booklet have? Is there a limit to the pages in a publisher booklet. Each page has three photos. There is no limit, your RAM may decide for you. What version Publisher? -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Verystumped" <Verystumped@discussions.microsoft.com> wrote in message news:8F2778CF-7B14-4BDD-93C5-EF9B39E2C1A7@microsoft.com... > Hi how many pages can a booklet have? Is there a limit to the pages in a > publisher booklet. Each page has three photos. ...

Use a VBA Macro inside an Excel Cell
This is a multi-part message in MIME format. ------=_NextPart_000_02B7_01C9F6B9.C9F418D0 Content-Type: text/plain; charset="windows-1255" Content-Transfer-Encoding: quoted-printable its been helpful to me so maybe it will do good for you too: how to create a simple macro within Microsoft Excel, and then how to use = that macro to calculate a single cell value. http://sysudi.blogspot.com/2009/06/use-vba-macro-inside-excel-cell.html ------=_NextPart_000_02B7_01C9F6B9.C9F418D0 Content-Type: text/html; charset="windows-1255" Content-Transfer-Encoding: quoted-printable &l...

Link to Page when saving to web
Hi, I have some drawings that have several shapes with "Go to page on double-click" behavior. How can I keep this functionality when saving as a web page? Thanks ...

Excel number formatting #2
I receive spreadsheets with separate columns of numbers and text. The problem is that the numbers column is not in number or general format (when sorting behaves like text). Is there a way to turn those columns into numbers (except stepping into each one separately)? When I just highlight the number in the cell and hit enter, the cell automatically becomes numeric (I'm looking for a more global solution). Thanks, A You can do this: 1. Type 1 (the number 1) into a blank cell. Highlight this, select Edit, Copy. Now highlight entire column(s) that you want changed to numeric, and sel...

Summarising per page
Hi all, I have a worksheet that contains a list of numbers, and in printout is more than 5 printed pages. What I want is to summarise the list per printing page. I want to do this for any printed page length (i.e. Letter, A4,) or orientation (Portrait, Landscape). Thanks in advance, Regards Nick Hi have a look at http://tinyurl.com/2pxmw -- Regards Frank Kabel Frankfurt, Germany Nick Karoumpalos wrote: > Hi all, > I have a worksheet that contains a list of numbers, and in printout is > more than 5 printed pages. > What I want is to summarise the list per printing page. > ...

insert text to different pages and update
Is there a way to insert a text cell from one page put into another page and when the first page cell is updated the second page cell will also be updated. Using the = sign just displays the formula, not the text. :confused: Thanks Frank -- fwburkey ------------------------------------------------------------------------ fwburkey's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=30314 View this thread: http://www.excelforum.com/showthread.php?threadid=505331 Not clear what you are doing wrong. the formula should look lik =Sheet1!A1 Make sure there is noth...

How do I reverse the order of the pages I've written?
I've written 56 pages in a new book in Publisher, but have inserted them in reverse order, ie; page 56 should be page 1, and so on. How can I fix this ? At the bottom of your screen are little numbered pages. Pick on them with your mouse and drag them where they need to be. -- JoAnn Paules MVP Microsoft [Publisher] Tech Editor for "Microsoft Publisher 2007 For Dummies" "kaybee" <kaybee@discussions.microsoft.com> wrote in message news:8D020743-D49F-4C02-A03C-7D09CB5553A7@microsoft.com... > I've written 56 pages in a new book in Publish...

MS Office Excel97: Removing Page Breaks
How do I remove page breaks? For some unknown reason they started appearing on a spreadsheet recently. I see dotted lines dividing up the sheet and large "Page ...." in the background. According to an Office 97 book I have, I should go to Tools->Options->View-tab and set the Page Break option off. There isn't any. If I right click outside the page area, I see PG menu items but none seem to work. There's also a PB View in the View menu, but clicking on it doesn't seem to do anything. Weird. -- Wayne T. Watson (Watson Adventures, Prop., Nevada Cit...

Stop changing of languages in Word 2003 when typing letter.
While typing a letter in Word 2003 it changed from English to what looked like Arabic language. I have rebooted 3 times and started over and still the same occurs. I even copied what I had in English to an email in Yahoo and sent it to myself and rebooted. Came back to that same email and copied it to a new email that I started to myself, and when I started typing it would only type in what looked like Arabic language. This happened to me once a couple of weeks ago, but never occurred again till now. What do I do? In the Language dialog box, turn off the option to autom...

Extra word prints that does not show when viewing the document
When I print my document or view it, this extra word is not there. When the document prints, this hidden word is in the printed document. How do I find this hidden word and delete it? If it prints, you know where it is. Have you turned on your nonprinting characters, etc? Have you tried copying and pasting it into a new blank document? -- JoAnn Paules MVP Microsoft [Publisher] Tech Editor for "Microsoft Publisher 2007 For Dummies" "S Roberts" <S Roberts@discussions.microsoft.com> wrote in message news:C437AFE5-8C0F-4859-8994-AA78D18CA573@mi...

Excel chart linked in Word gets formatted when updateing.
Hi, I have a bit of an annoying issue with excel and word 2007, I have a Chart in excel, and the text on the horizontal axis is rotated 270 degrees,This Chart is linked in a Word document and when i do an update of the linked chart the text gets all messed up. Both of the files are saved in 97-2003 format. ...

page break preview #3
I have created a new "sheet" in my workbook. My first sheet includes Page 1 to Page 22. I want my second sheet to start at Page 17, which I changed on the page setup page, however, the page break preview is still showing PAGE 1. How can I change this to show Page 17? VickiJo, If you're printing or previewing sheets separately, you'll get a starting page number of 1. If you're printint or previewing multiple sheets, it'll continue the page numbers from sheet to sheet. The First Page Number (File - Page Setup - Page tab) must be set to "Auto" for ...

Printing with the Headers showing on every page
How do I print a large spreadsheet where the column headers show up on every printed page? -- Dave File > Page Setup, click on the Sheet tab, then in the "Rows to Repeat at Top' indicate which rows comprise your header (ex: $1:$1). "Dave" wrote: > How do I print a large spreadsheet where the column headers show up on every > printed page? > > > -- > Dave What if that's grayed out? How do I do that then? -- Dave "bpeltzer" wrote: > File > Page Setup, click on the Sheet tab, then in the "Rows to Repeat at > ...

how do i construct a bar in microsoft word?
how do i construct a bar in microsoft word? > how do i construct a bar in microsoft word? Use Word to write a letter to a general contractor. Ask the contractor for a quote to build a tavern to your specifications. Be as specific as you can about the specs. ...