Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Getting Current Page Number... A Solution


Hi all,

Here is a solution to getting the current page number in a Word document using Visual Basic. Please help other as much as you can.

The trick is to insert a new Field having a page code that gets the current page, get its value and then delete it and hope that it will not scrap the text formating. Here is code...


Public Sub Extraction()

' Basic line for application stability
On Error Resume Next

'This disable the screen update
Application.ScreenUpdating = False

'This adds the field that will give you the current page
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:="PAGE * Arabic ", PreserveFormatting:=True

'This use the GoTo method to select the Field just inserted
Selection.GoTo What:=wdGoToField, Which:=wdGoToPrevious, Count:=1, Name:= _
"PAGE"

'This output the value of it... the current page number
MsgBox (Selection.Words(1))

'This erase the inserted Field
Selection.Delete

'This enable the screen update
Application.ScreenUpdating = True

End Sub


Regards,

YX




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
I Need To Extract The Page Number From The Current Page In Word
I need to extract the page number from the current page in word and put it in to the variable pgNum

HELP!!

Current Page Number
Hi all,

I wrote a VB script that iterates over all tables in a Word document. My problem is that want to write out the current page number (that means the page number where the table was found) in a file.
But how do I get the current page number?
Is there a function of a table object that returns the current page number?
I tried to find something in the VB help but withoau success.

Can some help me?

Datereport Page Number {Page Number Resolved But Other Query Remains}
Hi all

This code displays my reading table on the next page if the variable blnShow is True that means if i need to display a chart else it displays the readings on the first page itself

In the previous case as the reading are shifted to the next page the page number is also not displayed at the bottom
How can i show the page number

The page number is in the Page Footer section

Code: If blnShow = True Then
        With rptPump
            Clipboard.Clear
            frmChartHist.MSChart1.EditCopy
            .Sections("Section4").Controls("Image1").Height = 7000
            .Sections("Section4").ForcePageBreak = rptPageBreakAfter
            Set .Sections("Section4").Controls("Image1").Picture = Clipboard.GetData
            .Refresh
            .Show
        End With
    Else
        With rptPump
            .Sections("Section4").ForcePageBreak = rptPageBreakNone
            .Sections("Section4").Controls("Image1").Height = 1
' .Sections("Section4").Visible = False
            .Sections("Section4").Height = 1600
            .Show
        End With
    End If

[EDIT] How can i display the page numbers as 1 of 2,2 of 2 for a datareport?

Hope m clear.Let me know

Samir
Skill is successfully walking a tightrope over Niagara Falls. Intelligence is not trying.

Edited by - samirprabhudesai on 4/16/2004 2:32:32 AM

Error 3201 - No Current Record - A Solution?
I'm desperate for a solution as simple as possible.
even
e.g. If rcset = NULL or something !!!! I'm a beginner

Retreiving The Values Of Controls Of Previous Page On Current Page In Asp.net
i am working on webform2 having radiobutton1 which has been redirected from webform1 also having radiobutton1

how do i access webform1's radiobutton1.value ?

Kindly help

regards

Sanjish

Multi Page Image Viewer Solution
ImageViewer CP 2.0 release
You can Print the Image to Printer.
Smooth Scrolling improvement in Version 2.0.
Rotate and zoom the image easily.
Export Image to JPEG, GIF, BMP, TIFF, PNG according to your chosen size of display area.
Support loading Multi-Page Image File(TIF).

download vb sample code
http://viscomsoft.esmartweb.com

Auto Number Solution (ADO)
I have seen on here a few problems with Autonumber using MsAccess. I kept running into a problem that if I had a 100 bits of data and deleted one like number 50 when I tried to add a new one there would be gaps or it would have an error of the same id. I was using the code of getting the max +1. To fix this problem I just did a query to find the missing numbers. This should work for multi and single applications if call the funtion in the save button.

I know this isn't a good way to loop but it is effective.


VB Code:
Function GetNum() counter = "1"Looper:Aado.RecordSource = "SELECT * FROM TableName WHERE ID Like '" & counter & "'"    Aado.Refresh    If Aado.Recordset.RecordCount = 1 Then        counter = counter + 1        GoTo Looper    End If    End Function


Opps I posted this in this area by accident I input it into the Database area as well.

(need Solution Not Comment) How Can Add Record Number)
how can i add auto number in datagrid each data in field no record
i only want to use this uto number temporary
i group my data by name
if i entry the name it would be filter data but in is not have no record
how can i add this record number?
i have more than 100 data

INET/WinSock/HTTPRequest API To Handle Page Redirect ... Any Solution?
Hello to All Forum Members;

I'm currently working on an Application which periodically checks external-IP address of a machine by visiting a Website URL. My client has established a script which does not have a direct URL to PHP script which returns the IP address of polling PC, it has a referral URL technique implemented in Refresh meta tag.

I tried using INET OCX but as expected, it failed to collect the final result, the External IP address as returned by URL. Instead, INET collects the code of page which actually Redirects the browser to other URL. This code has a JavaScript code which is actually causing this Redirect. The JavaScript is as follows ...


Code:
<script language="javascript">
var myhostname = "checkip.pixend.be?Server=logtest";
//alert("Hey Nice to see you " + myhostname);
myRe = /^(.*):([0-9]*)(.*)/;
var newname = myhostname.replace(myRe,"$1$3");
//alert("I changed URL to:" + newname);
document.write("<meta http-equiv="Refresh" content="1; URL=" + "https://" + newname + ":19638/webhost/rollout">");
</script>

If you type "http://checkip.pixend.be?Server=logtest" in Browser Address bar then Browser successfully collects and returns the IP address. However, if you give the same to OpenURL of INET OCX, then it returns the Redirect Page Code. Is there any workaround for this? Can we make INET API or WinSock to support the Page Redirect based on "Refresh" meta tag?


Currently, I'm using Web Browser Control but client is facing some difficulties in installation of this Application on his different machines. So, I need to find out some alternative method to handle this Page Redirect issue. Please let me know if there is any Visual Basic 6.0 example code or link which will help me to get rid of this problem.

Waiting for your valuable reply ...

Regards,

Ruturaj.

Page Number &amp; Page Count In Word (automation)
I think I've searched quite everywhere for this, and I haven't found any information at all. I want to be able to write (in VB) the page number and page count in the footer of a Word document, using Automation. I can alreay write the page number OR the page count, but not both, and I can' t add text to the footer.

I want something like "Page 2 of 5" in the footer of every page of the Word document, but I can't seem to get the hang of it, and I've run out of options. Thanks to anyone taking the time to read this post, and many thanks to anyone with a possible solution!

Raggart

Findind Line Number And Page Number In Word
I am Writing an application that will write the contents of a RTF on to a word doc. I will have to search through this word document for a list of words and then find out the line number at which the word appears and also the page number in which it occurs.

The problem i am facing is that word wraps the lines after a specified width where as I am searching for an end of line using vbcrlf. How can i retrive line by line just as the way it will appear in a word document.


Thanks in Advance
Rama

Displayed Page Number Vs. Word Page Num
I'm trying to get the page num which appears in the footer using the {PAGE} field into a VBA variable. I've tried using:

Selection.Information(wdActiveEndPageNumber)

but that returns the actual Word page number (ex: 5), rather than the {PAGE} num (ex: 2-1)

Any assistance is appreciated.

01000111

Getting The Current Open Page
Hello,
I have managed to create a new toolbar item in internet explorer, and i wish to have it so that when you click it, the vb program loads and gets the webpage from which ie currently has loaded? is there anyway this can be done from the vb app?
Thanks

Web Browser Current Page
when i was creating a web browser for my college assignment i found a tutorial on this site to help and when i put in the code for the history it worked but it also showed the current page on the title bar (which i wanted it to do), but when you change to a different site it just added the next site address to the title bar.

heres the code:


VB Code:
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)    On Error Resume Next    Dim i As Integer    Dim bFound As Boolean    Me.Caption = WebBrowser1.LocationName    For i = 0 To Combo1.ListCount - 1        If Combo1.List(i) = WebBrowser1.LocationURL Then            bFound = True            Exit For        End If    Next i    mbDontNavigateNow = True    If bFound Then        Combo1.RemoveItem i    End If    Combo1.AddItem WebBrowser1.LocationURL, 0    Combo1.ListIndex = 0    mbDontNavigateNow = FalseEnd Sub



many thanks for the help

Get Web Address Of Current Page
Hi
How can I get the main web address of the current page . I will be using IE 5 and I need this information for my VB program.
Thanks

How Can I Get/set The Current Margins Of A Page?
Hi everybody,
I have somp problems handling new page jumps with the printer object.
I mean, I know how to get the paper size, and I know how to keep track of the lines I am printing, but the page jump is always too late, because the actual print area is smallet than the true paper size.
Can anybody tell me how to get or set the printable area of a page?
Thanx

Capturing The Current Internet Page?
Is there a way of capturing the current page being looked at on my pc in internet explorer and getting all the text from it?

DataReport And Printing Current Page Only
All,

I wrote a program to track equipment transfers from one account to another. It also saves them in an Access database, so I can an electronic record of them.

Once the user completes the form, they click on the Print button, which brings up the DataReport. Unfortunately, it shows all the records. So, the user has to navigate to the end, to their report, to print it.

How can I code it so that the DataReport will only show the current record on the program?

Thank you in advance!

How Can I Get The Current Ie Home Page In Text1?
How can I get the current "IE" home page to read out in text1 .

Change The Current Home Page In PWS ?
hello...
I installed PWS to active IIS
but the PWS select a home page by default
how can i change it ?


------------------
BlackRose

Vbscript To Refresh Current Page
Hi, I need help please!
I need a script to refresh the current page.
Reason being is that i had jscript tooltip in an xslt file that works fine when first time the page is loaded but once onpostback - it does not work.
So i can't edit the aspx file becuase the entire site uses the file.
So i would like to Refresh the Current ASPX/Page so that it at leats works the first time user opens page!
Please Assist!
Regards

Vbscript To Refresh Current Page?
Hi, I need help please!
I need a script to refresh the current page.
Reason being is that i had jscript tooltip in an xslt file that works fine when first time the page is loaded but once onpostback - it does not work.
So i can't edit the aspx file becuase the entire site uses the file.
So i would like to Refresh the Current ASPX/Page so that it at leats works the first time user opens page!

strStUOM = "aObjects("FG1030StUOM")"
If strStUOM = "Liter" Then

window.location.reload(true)
End If
This gives me an error: Object required: 'window'

Please Assist!
Regards

Fax Current Page Using An ASP Button Event.
I have an ASP.NET web application with VB.NET as the code behind. We are using XP Pro as the client and and Windows 2000 Small Business Server with Shared Fax Service on. We have an event that brings up a preview confirmation page before we fax it to the client. When we are satisfied with the preview page I want them to be able to hit a button on the bottom of the .aspx page that then fires of an event to fax the this page to the client. I have tried using the FAXCOMXlib but the server seems to repond with the following error "The fax server API version does not support the requested operation." Below is a small piece of information that I am testing with, which I am borrowing from someone in the vbcity forum, this is it:

Dim objFaxDocument As New FAXCOMEXLib.FaxDocument
        Dim objFaxOutgoingQueue As FAXCOMEXLib.FaxOutgoingQueue
        Dim g_objFaxServer As FAXCOMEXLib.FaxServer

        Dim objSender As FAXCOMEXLib.FaxSender
        Dim JobID As Object
        'intTemp = 0
        Dim schTime As Object

        'Error handling
        'On Error GoTo Error_Handler

        'Initialize the FaxServer object.
        g_objFaxServer = New FAXCOMEXLib.FaxServer


        'Connect to the fax server
        g_objFaxServer.Connect("TROON")

        'Set the fax body
        objFaxDocument.Body = "c:simple.txt"

        'Name the document
        objFaxDocument.DocumentName = "Test Fax"

        'Set the fax priority
        objFaxDocument.Priority = FAXCOMEXLib.FAX_PRIORITY_TYPE_ENUM.fptHIGH

        'Add the recipient with the fax number 12225550100
        objFaxDocument.Recipients.Add("3341013", "LevelOne")

        'Choose to attach the fax to the fax receipt
        objFaxDocument.AttachFaxToReceipt = True

        'Set the cover page type and the path to the cover page
        objFaxDocument.CoverPageType = FAXCOMEXLib.FAX_COVERPAGE_TYPE_ENUM.fcptSERVER

        'objFaxDocument.CoverPageType = fcptSERVER
        objFaxDocument.CoverPage = "generic"

        objFaxDocument.Subject = "Today's fax"

        'Submit the document to the connected fax server
        'and get back the job ID.

        JobID = objFaxDocument.ConnectedSubmit(g_objFaxServer)

        objFaxDocument = Nothing
        objFaxOutgoingQueue = Nothing

Main question is, is there a way to fire of an event that will cause the shared fax client to start then fill the to: box in the dialog with the fax number of the client automatically. Help!!!!

Open Website On Current Opened Page
hiiii guyessss

i want some one help me to solve this question , i want to open any URL website like " www.vbforums.com " but i want to open it on current active explorer page not on new page okkk because i searched more about it but i found code can open Url on anew explorer nooooo , i want to open it on current active explorer okkkk


please help me fast

Display Current Row Number
How can I return the current row number of the Active Cell?

Thanks

Frankie

Please Help... How I Can Get The Current Row Number In Flexigrid...
Anyone who can help me, i just want to know the current row position of my flexigrid... thank you...

To Know The Current Record Number
i want a label to write the current record number on my application. is there any function for that? thanks

Number Of The Week Of The Current Year?
Hello, does anyone knows a easy way to get the number of the week of the current year?

btw, this would be to use in a vbscript if that matters in the case

Get The Number Of The Current Line Which Is Being Edited
How can i get the number of the line which is being edited in a rich textbox?
For example, i have a text in the a rich textbox which is 10 lines long.
I'm editing the 3rd line (which means that the lil icon I is in that line).
I need to get the number 3 since i'm editing/writing the 3rd line.
How can i do that? (Hopelly some1 knows)
tnx

How To Know The Current Line Number Of The Code?
Sometimes when I am writing the code, I want to know the current line number. How to make the Visuall Basic editor show the line number? Thanks.

Ado /Datagrid Current Record Number
Somebody help pls..!!!
How will I know the current record number in an ADODC recordset output in DataGrid control?
It seems there is no property for that..
Thanks for any helping hands

Cecile


The more u read, the more u do not know

Establishing Current Word Section Number In VBA
Not sure if it's just me not being able to concentrate in the heat, but I can't find much info anywhere on how to establish what the 'current' section number of the document is from within VBA. In other words, I just want to perform some formatting operations on the entire section of the document that the cursor is in.

Any clues would be much appreciated.

TIA

Textbox Format To Current And Phone Number
In VB6 using visual basic code

how do I set the input format to currency (to display dollar signs) and a textbox to a phone number

ex: 602-555-5555

999-999-9999 to display the two - dashes when typing a number
and to be saved with the dashes or be able to retrieve the numbers with the text box displaying the value with dashes

Thanks for your help


And you happen to know how to set a text box to display capitalized letters only like in the state box AZ but

Thanks ,
Zoila

Get Record Count And Current Row Number ADODB Recordset
How do i get the record count and current row number from an ADODB recordset?


Thanks
GK

Page Number
hello!!
how can i insert in the foot of an excel sheet the page number from vb??.

Number Page Format
Hello!
My question is about Word. I have four formats when I insert a number page down of the page. I want to put a specific number format in the number page. First the number of the page and left side the total number of pages. How can I do it?

Thank's

Jaume

Page Number And/or Mergefields
Word doesn't recognize mergefields in headers and footers for some reason. So I need to know how to loop through the first few pages of a document, look at the headers, and strip out the merge fields. I've already got the code for stripping out the mergefields in the header, but how do I get the current page number and move down 1 page at a time?? Any help?

I've used the BuiltInProperties(wdpropertypages) to get the total number of pages, how do I get the current page number and move down!

Word - Get Page Number
Hello,

how can I get the page number of the current cursor position in a word document?

thanks for help!!

stefan

Skipping The First Page Number
I was wondering if ther was any way make Excel skip the page number on the first page, and thus the page numbers would start on the second page with 2.

Word Page Number In VB
We are integrating word with visual basic and while searching thru the document for a particular value, we wish to know that on which page number that value is found. we tried using various combinations but all in vain. can anybody help me out.

Thanks in advance

Raj Dhawan

Page Number On A Datareport
ok, I have a new question.

I want a label to be visible, if the report is on page two and so on.
But I am not sure on how to grab a page number from my report.

Thank you for you help.

he9ap00

Show Page Number
Hi all,

I don't know how to show Page Number in Data Report ?

thanks for read !

Get Report Page Number
Hi

I havew a report with many unlim=nked subreports in its report footer section. I have created a seperate section here for each report I put in. On each subsection I placed the special formula field PageNofM. When I view the report using the crystal report viewer through vb, I would like to know how to get a subreports page number Through code, Ie in the program I pass through a subreport name and the code looks for that subreport and returns its page number.

Thanking you in advance

SL55

Page Number In DaraReport
How to bring the Page Number, Total Page Count in a DataReport Preview.
Thank You in Advance
-J.S.VijayRagavan

How To Print A Utf-8 Number To A ASP Page
I have a utf-8 unicode E999A2, which is a Chinese character. How can I print out this chinese character in a ASP page.

I can use "Response.Write(chr(&H41))" in my ASP VB script to print out "A" on the page. But couldn't figure out how to do the same thing to chinese characters which is utf-8 based unicode.

Dadareport - How To Get The Page Number?
Hello everybody,
I want to know the number of the page when i browse the datareport -
please dont tell me to use a label with %p because i dont know how to get it as a number.
or you just might tell me how to use a label and get the page number while browsing the report.
Thank you all in advance,
i hope someone will answer my question,
ERAN

p.s. Maybe there is a way to catch the "go to next/prev page" event?
<| <-- --> |>

Datareport Page Number
Hi

i m using datareport for showing a chart and readings followed by that
now what i want

i have a form that prints the report
on this i select whether i need a chart or not
if i select that i need a chart then the chart shud b printed on the "FIRST" page and the readings shud follow on the second page onwards.
if chart is not selected then only the readings shud be printed from the first page onwards

hope m clear


Samir
Skill is successfully walking a tightrope over Niagara Falls. Intelligence is not trying.

How To Count The Excel Page Number??
Dear All,

I have a program that Export the Data to the Excel to generate a time table to all the students and lecturers with have assigned to different course and class. In order to print the time table i have to calculate the page number of the Worksheet!!

The How to count the Page Number?????

Total Of Printed Page Number
i need help on how to find number of total page printed...for example i've printed microsoft word document and want to obtain the number of total pages printed..i try printer.page but the output is 1...

i'm using shellexecute method and print from the commondialog option

Copyright © 2005-08 www.BigResource.com, All rights reserved