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!!
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Page Number & 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
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
Word - Loop Through Each Page In Document And Copy Page With Page Format
Here's what i'm trying to accomplish
1 - Start at first page and get page format (portrait/landscape)
2 - Copy page and paste it into a new word document with original format
repeat these steps until all pages have been copied
I need the condition where a document has both portrait and landscape pages.
Anyhelp would be appreciated
Extract A Word From A Web Page...
How would I go about getting a single word from a web page? Lets say I go to iwin.com and want to get the amount for icoins (points) that the user currently has and display it in a text box...how would I do that?
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?
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
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
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
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
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
MS Word/Page Number Won't Update Auto/Help
Hi,
I have created a fax template and in a section of the page I have:
Pages (including this one): {NUMPAGES * MERGEFORMAT}
When I go onto the second page this doesn't update and I have to manually highlight it > left click > Update field
Is the a way for this to happen automatially like it does in the HEADER/FOOTER?
Many thanks
Richi
Start With Different Page Number In Word Document
Hi,
I have a document within which there is a macro that fetches images (TIF Format) from a server and stores it locally on temp (c: emp). On pressing F11 on the document it compares the TIF filename from temp to the filename stored in the DB. If both the names match then the image is pasted or displayed on a new document, which is automatically created.
For each image displayed there is a corresponding title for it, which is captured from the DB and displayed in the Header. Simultaneously page numbers need to be displayed on the footer for the images.
A particular header can have more than one image. Once the header differs there is New Section Break, but the page number needs to continue. To add to that the user can add a different page number from the front end (a VB app) that is stored in the DB.
Issue is I can either get different headers to be displayed (based on the section break) or the page number to be displayed correctly (based on the page number entered from the VB App). I need both of them to be displayed in order to roll out this particular module.
Please Help !!!
Find below the code:
-------------------------------------------------------
Sub PictureMacro()
Dim oCn1 As ADODB.Connection
Dim oRs1 As ADODB.Recordset, oRs2 As ADODB.Recordset, oRs3 As ADODB.Recordset, oRs4 As ADODB.Recordset, oRs5 As ADODB.Recordset, oRs6 As ADODB.Recordset, oRs7 As ADODB.Recordset
Dim Directory As String, FType As String, FName As String
Dim connection1 As String, sSQLStmt1 As String, sSQLStmt2 As String, sSQLStmt3 As String, sSQLStmt4 As String, sSQLStmt5 As String, sSQLStmt6 As String, sFilename As String
Dim sDocket_Desc As String, Sub_Number As String, sSplit As String, sCurPage As String
Dim rng As Range, oRange As Range
Dim position As Integer, J As Integer, StartPage As Integer, Sub_Count As Integer
Dim v_start_page As Integer, v_end_page As Integer, v_tot_pages As Integer, CurPage As Integer
Dim Docid As Variant, Pageno As Variant, v_secid As Variant
Dim Docket_Desc As Variant, v_tmp As Variant, SecPages As Variant, temp_secid As Variant
Dim TifName() As Variant
Const DotPath As String = "\apsrv46hSaberAppealsPackageClerksPaper.dot"
'Connecting to DB
connection1 = "Provider=MSDAORA.1;" & _
"Password=scl_edms;" & _
"User ID=scl_edms;" & _
"Data Source=sclprod"
Set oCn1 = New ADODB.Connection
oCn1.Open connection1
'End of Connnection to DB
Directory = "c: emp"
FType = "*.tif"
With Application
.FileSearch.FileName = FType
.FileSearch.LookIn = Directory
.FileSearch.Execute
If .FileSearch.FoundFiles.Count > 0 Then
Documents.Add (DotPath)
End If
'For Retrieving the Starting Page # if entered in the Clerks Paper Form.
sSQLStmt3 = "select nvl(stpageno,0)as stpageno from scl_edms.appeals_pkg where id = (select min(id) from scl_edms.appeals_pkg) "
Set oRs3 = oCn1.Execute(sSQLStmt3)
StartPage = oRs3.Fields("stpageno").Value
'End of Retrieving the Starting Page #
'Count of number of sub doc numbers for appeals package
sSQLStmt6 = " select count(subdocnum) subcount from scl_edms.appeals_pkg "
Set oRs7 = oCn1.Execute(sSQLStmt6)
Sub_Count = oRs7.Fields("subcount").Value
'End of count of sub doc numebr for appeals package
' Initializing variables.
temp_secid = 0
v_tmp = ""
If (IsNull(StartPage) Or (StartPage = 0)) Then
v_start_page = 1
v_end_page = 0
Else
v_start_page = StartPage
v_end_page = v_start_page
End If
ReDim TifName(0)
'End of initializing variables
'Fetching of the TIF filename from the database
sSQLStmt4 = " select ap.docid, i.filename "
sSQLStmt4 = sSQLStmt4 + " from scl_edms.appeals_pkg ap, hv_user.hvdocument d, hv_user.hvdocsec s, hv_user.hvimages i "
sSQLStmt4 = sSQLStmt4 + " where ap.docid = d.docid and d.docid = s.docid and s.secid = i.secid "
sSQLStmt4 = sSQLStmt4 + " order by ap.id "
Set oRs5 = oCn1.Execute(sSQLStmt4)
'End of fetching of TIF Filename from DB
J = 1
Do While Not oRs5.EOF
Docid = oRs5.Fields("docid").Value
TifName(0) = oRs5.Fields("filename").Value
TifName(0) = CStr(J) & "_" & TifName(0) & ".tif"
.FileSearch.FileName = TifName(0)
FName = "c: emp" + TifName(0)
sSplit = Mid$(FName, Len(Directory) + 2)
position = InStr(sSplit, "_")
sFilename = Left$(sSplit, Len(sSplit) - 4)
sFilename = Right$(sFilename, Len(sFilename) - position)
'Query to get Docket Description and Sub Doc Number from Appeals Package table and Docket table
sSQLStmt1 = " select substr(ap.DOCKET_NAME, 1,100)docket_name, dk.SUB_NUMBER, i.filename, dk.docid, i.secid "
sSQLStmt1 = sSQLStmt1 + " from hv_user.hvimages i, hv_user.hvdocument d, hv_user.hvdocsec s, hv_user.hvvolume v, scl_edms.docket dk, scl_edms.appeals_pkg ap "
sSQLStmt1 = sSQLStmt1 + " where ap.docid = dk.docid and dk.docid = d.docid and d.docid = s.docid and s.secid = i.secid and i.volid = v.volid "
sSQLStmt1 = sSQLStmt1 + " and ap.docid = '" + CStr(Docid) + "' "
Set oRs1 = oCn1.Execute(sSQLStmt1)
'End of Docket Information Retrieval
Docket_Desc = oRs1.Fields("docket_name").Value
Sub_Number = oRs1.Fields("sub_number").Value
v_secid = oRs1.Fields("secid").Value
CurPage = Selection.Information(wdActiveEndAdjustedPageNumber)
'Retrieving the max page number for the specific secid
sSQLStmt3 = " select max(a.pageno) as pageno from hv_user.hvimages a, hv_user.hvdocsec b "
sSQLStmt3 = sSQLStmt3 + " where b.Docid = Docid and a.secid = '" + CStr(v_secid) + "' "
sSQLStmt3 = sSQLStmt3 + " and b.secid = a.secid "
Set oRs4 = oCn1.Execute(sSQLStmt3)
Pageno = oRs4.Fields("pageno").Value
'End of retrieving the max page number
'Display of Page Number in the Footer on the right
If StartPage = 0 Then
Selection.InlineShapes.AddPicture FileName:=FName, _
LinkToFile:=False, SaveWithDocument:=True
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.InsertBreak Type:=wdSectionBreakNextPage
Selection.Sections(1).Headers(wdHeaderFooterPrimary).Range.Font.Size = 9
Selection.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text = Docket_Desc
Selection.Sections(1).Headers(wdHeaderFooterPrimary).LinkToPrevious = False
If (v_tmp = Docket_Desc) Then
v_end_page = (v_start_page + Pageno - 1)
Else
With Selection.Sections(1).Footers(wdHeaderFooterPrimary).PageNumbers
.NumberStyle = wdPageNumberStyleArabic
.IncludeChapterNumber = False
.ChapterPageSeparator = wdSeparatorHyphen
.RestartNumberingAtSection = False
.StartingNumber = v_start_page
End With
Selection.Sections(1).Footers(wdHeaderFooterPrimary).PageNumbers.Add PageNumberAlignment:= _
wdAlignPageNumberRight, FirstPage:=True
v_start_page = v_end_page + 1
v_end_page = (v_start_page + Pageno - 1)
v_tmp = Docket_Desc
End If
Else
'If user enters a different page number
Selection.InlineShapes.AddPicture FileName:=FName, _
LinkToFile:=False, SaveWithDocument:=True
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.InsertBreak Type:=wdSectionBreakNextPage
'Selection.InsertBreak Type:=wdPageBreak
Selection.Sections(1).Headers(wdHeaderFooterPrimary).Range.Font.Size = 9
Selection.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text = Docket_Desc
Selection.Sections(1).Headers(wdHeaderFooterPrimary).LinkToPrevious = False
If (v_tmp = Docket_Desc) Then
v_end_page = (v_start_page + Pageno - 1)
Else
'Currently commented as it does not display the correct page number
'With Selection.Sections(1).Footers(wdHeaderFooterPrimary).PageNumbers
' .NumberStyle = wdPageNumberStyleArabic
' .IncludeChapterNumber = False
' .ChapterPageSeparator = wdSeparatorHyphen
' .RestartNumberingAtSection = True
' .StartingNumber = v_start_page
'End With
' Selection.Sections(1).Footers(wdHeaderFooterPrimary).PageNumbers.Add PageNumberAlignment:= _
' wdAlignPageNumberRight, FirstPage:=True
'End of commented code
If Sub_Count > 1 Then
v_start_page = v_end_page + 1
v_end_page = (v_start_page + Pageno - 1)
Else
v_start_page = v_end_page '+ 1
v_end_page = (v_start_page + Pageno - 1)
End If
v_tmp = Docket_Desc
End If
End If
'End of Display of Page Number in the Footer on the right
'Adding # of pages for each section to the DB (Appeals_Pkg)
sSQLStmt2 = " update scl_edms.appeals_pkg "
sSQLStmt2 = sSQLStmt2 + " set pagenos = '" + CStr(v_start_page) + "'//'-'//'" + CStr(v_end_page) + "' "
sSQLStmt2 = sSQLStmt2 + " where docket_name = '" + Docket_Desc + "' and docid = Docid "
Set oRs3 = oCn1.Execute(sSQLStmt2)
'End of Adding # of pages to DB
With Selection.Font
.Name = "Arial"
.Size = 10
.Bold = True
End With
oRs5.MoveNext
J = J + 1
Loop
End With
oCn1.Close
End Sub
------------------------------------------------
Please HELP !!!
Thanks,
Rick
How Can I Select ONE Page Of A Multi-page Word OLE Document?
Hello,
I have the following code that works just fine as long as I have a Single-page word document loaded. However, I need to Select EACH page individually and rasterize into a TIF image. You will note that I am able to Find Text and Select the Entire Line. I can also Select the ENTIRE document using the "OLE1.object.Content.Select" method. But I just can't seem to figure out how to select a Single Page!!!
Once I use the ".Copy" method I AM able to "Paste" it into my Imaging Viewer (Pegasus ImagXpress) object. It is critical that I save these pages individually. Here is the code I'm using for this:
Code:
Private Sub Command3_Click()
OLE1.DisplayType = 0 ' Display object in the control
OLE1.CreateEmbed "C:Merged.doc", "Word.Document"
OLE1.DoVerb vbOLEActivateGetFocus
OLE1.SizeMode = vbOLESizeStretch
'Find Text
With Selection.Find
.ClearFormatting
.MatchWholeWord = True
.MatchCase = False
.Forward = True
For i = 1 To 10
.Execute FindText:="Client Account #:"
DoEvents
If .Found Then
With Selection
.EndOf unit:=wdLine, Extend:=wdSelStartActive
' Copy the selection to the Clipboard
.Copy
' Paste the entire selection into the Text1 form field
Text1.Text = Trim(Clipboard.GetText)
' Break out the Account # and paste it into the Text2 field
Text2.Text = Right(Text1.Text, Len(Text1.Text) - InStrRev(Text1.Text, ":"))
End With
End If
DoEvents
'Select the entire document
OLE1.object.Content.Select
With Selection
.StartOf unit:=wdGoToAbsolute extend:=wdline
'Copy selection to clipboard
.CopyAsPicture
End With
DoEvents
Form2.ImagXpress1.Paste
MsgBox Form2.ImagXpress1.ImagError ' Shows Zero if No Error
Form2.ImagXpress1.Refresh
Form2.Show
DoEvents
'Goto next page
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext
Next
End With
' OLE1.Close
End Sub
Thanks,
Jacob
Edited by - JacobRusso on 11/18/2003 5:05:10 PM
Word - Read Page By Page
Hi guys,
I'm creating macro to send Word document as Fax to an API. From the Word template, I need to pick up three fields (Fax No, Sender Name & Subject) from each page and send the particular page as Fax. Then I need to jump to next page and select the next 3 fields and send that page as Fax.
I know how to search the fields in the document by using Code:Selection.Find.* command. But how do I read Page by Page? Currently, it always goes back to the first page when I do the search.
Please help.
P.S. The document is created by using Mail Merge and may consists hundreds of pages.
?? Extract Data From Web Page 4Vb Prj
Hello i'm tring to build a weather alert system
with Visual Basic 60, i need to ask if anyone
no's how to extract data from a web page so that i could
include it in my project.
say like this
:: HREF="/adcbin/curcon_local?nav=home&metric=0&partner=accuweather"><FON T COLOR="#9A9A9A" SIZE="1">(DETAILS)</FONT></A></B></FONT><BR>
<FONT FACE="helvetica,arial" SIZE="2"><B>PARTLY SUNNY.</B> Winds
?? PARTLY SUNNY ?? like how could i go exactly to "PARTLY SUNNY" since there's
so much <B> html codes and <FONT FACE=" on this web page
how could i just extract what i need on this page, when using the
search in notepage i found <B> many times, i would like to
go to a certain part of this web page and extract parts, then include
it in my vb weather project for my local weather area.
Thanks
How Can I Extract Data From A Web Page?
I am writing an application where I wish to "screen scrape" data from a Web Page. I believe that I use the Inet control for this, however, I am not familiar with how to use this control. Does anyone know of any good sample code that demonstrates this.
Thanks,
Blake
Web Page Data Extract.
I am trying to load a web page (to ultimatly extract data)
VB Code:
Private Sub Form_Load()WebBrowser1.Navigate "http://www.bom.gov.au/products/IDV60034.shtml"End Sub Private Sub WebBrowser1_DownloadComplete()Text1.Text = WebBrowser1.Document.documentElement.outerTextEnd Sub
The problem so far is I get Runtime error 91
Object Variable or with Block variable not set
Hmmm, missing the obvious!
Thanks Bloodeye, for the help so far. I thought I'd better start
a new thread
Printer Change Page Orientation From Page To Page
I'm running VB 5. Is it possible to change the page orientation from one page to another.
portion of code:
If page_orientation(gridno) = 0 Then
Printer.Orientation = vbPRORPortrait
Else
Printer.Orientation = vbPRORLandscape
End If
If I use "Printer.EndDoc" before the above code, the program works fine. Each page is a separate 'print-job' with the orientation that I want. A problem arises when I want to print to a .PDF printer: each page is saved as a separate PDF because they're all separate 'print jobs'.
If I substitute "Printer.EndDoc" with "Printer.NewPage", I get the error "orientation property cannot be set within a page". Is there any way to get around this?
Err: 'Page Header Plus Page Footer Is Too Large For The Page' With CR9.0
Dear All
I have a trouble making a report using Crystal Report 9.0. I am working on a project which is developed in vb 6.0. What it actually does is, pick some details from the DB (Access 2000) and shows it on the CR 9.0. I've made a TTX File for the same.
But as I run the report it gives an error msg which says Err: 'Page Header plus Page Footer is too large for the page'
To Mention : I am using the custome page size i.e. 6" x 8"..
Can any body help me plz...
Regards,
K****ij
Err: Page Header Plus Page Footer Is Too Large For The Page Using CR9.0
Dear All
I have a trouble making a report using Crystal Report 9.0. I am working on a project which is developed in vb 6.0. What it actually does is, pick some details from the DB (Access 2000) and shows it on the CR 9.0. I've made a TTX File for the same.
But as I run the report it gives an error msg which says Err: 'Page Header plus Page Footer is too large for the page'
To Mention : I am using the custome page size i.e. 6" x 8"..
Can any body help me plz...
Regards,
Kshitij
Extract E-mail Addresses Of A Web Page
Hi all !
i dont know if it is trivial or complicated , but i am new to internet programming ..i need to extract email address of a web page ...
could somebody please point me in right direction or give me some clues on how it could be acheived ..
appreciate all your help and suggestions
many thanks
daksh
daksh@interesource.co.uk
Extract Links From Web Page Souce Code
I was wondering how i would allow the user to select an extension from a combo box. (*.jpg,*.gif,*.wav,*.mp3 ,*.*, etc.) and then it would download the source code for a webpage and search through and extract the links specified.
What i am asking about is how would i do a search algorithm to extract the links specified.
For example i go to a page with 25 pictures and i put the url in my program and it goes out and downloads the source code and extracts all of the *.jpg images and adds them to a list box.
Extract Data From Web Page Created With A Template
I am trying to extract information from a web site which, with the help of this site, I have gained some proficiency in. I have the Web Browser control set up and I can sign in all the way to the screen I need to extract information from.
Below is a small snippet of the source code from this web site:
Code:
<!-- TEMPLATE.after tabs -->
l(14,"")
l(56,"Mmm")
l(49,"Mmm")
l(77,"Ssssss")
l(70,"Ssssss")
l(294,"")
n("")
l(14,"")
l(49,"Mmmmm")
l(49,"Mmmm")
l(42,"Ss")
l(35,"Ss")
l(42,"Ss")
l(35,"Ss")
l(63,"")
l(56,"Mortgage")
l(175,"")
n("")
l(14,"")
l(21,"Mm ")
l(21,"Mm ")
l(21,"Mm ")
l(49,"Mm")
l(77,"Sss")
l(63,"Sss")
l(84,"")
l(77," ")
l(133,"")
n("")
l(14,"")
l(28,"Mm")
l(35,"Mmm")
l(63,"Mm")
l(77,"Sss")
l(63,"Sss")
l(112,"")
l(49," ")
l(119,"")
n("")
l(14,"")
l(63,"Mm")
l(35,"Mm")
l(42,"Ss")
l(35,"Ss")
l(42,"Ss")
l(35,"Ss")
l(294,"")
n("")
l(14,"")
l(63,"Mm")
l(42,"Mm")
l(77,"Ssssss")
l(42,"Ssssss")
l(322,"")
n("")
l(7," ")
l(350,"--------------------------------------------------")
l(161,"---------------------- ")
l(42,"")
n("")
l(14,"¦ ")
d(490,"","O1003","&Z1003;")
From what I can tell, this was created using a template.
Can somebody point my in the right direction as to how I can reference the items on this web page so I can extract the information I need?
Thanks in advance for any help given.
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
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!
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
Page Number
hello!!
how can i insert in the foot of an excel sheet the page number from vb??.
[crystal Report] Avoid Printer From Ejecting Page After Printing A 3 Line Page
Im taking a printout in crystal report - but there are only 3 lines and after printing it goes to next page - but I dont want it to goto next page.
Instead I want it to continue the rest of the printing - which may be in some other report etc - to continue printing from where it left behind (maybe one or 2 lines break)
But after printing 3 lines it automatically ejects out the paper and goes to next page
How do I avoid this ?
Thanks
Edit by johnminkjan: Topic Title
Anjanesh
Edited by - johnminkjan on 9/7/2004 12:01:29 PM
RESOLVED - Can't Get Page Setup Dialog To Show Page Size Correctly
Hey guys and gals, I am hoping someone will have an idea on this one . . .
I am trying to show the page setup dialog and prepopulate the values of the page setup dialog before it is shown. All of the form pre-population seems to work except paper size. I can retrieve paper size just fine after the user clicks ok on the form, I just can't seem to set it before the form is populated.
I created a tiny test app to illustrate my problem.
VB Code:
' on a formOption Explicit Private Sub Command1_Click() With Printer' Height & Width; Printer object — the physical dimensions' of the paper set up for the printing device; not available' at design time. If set at run time, values in these properties' are used instead of the setting of the PaperSize property.' .Width = 14' .Height = 8.5 .PaperSize = vbPRPSLegal .Orientation = vbPRORLandscape End With ShowPageSetupDlg MeEnd Sub '********************************************************************' IN A MODULE! Option Explicit Const CCHDEVICENAME = 32Const CCHFORMNAME = 32Const GMEM_MOVEABLE = &H2Const GMEM_ZEROINIT = &H40Const DM_DUPLEX = &H1000&Const DM_ORIENTATION = &H1&Const PSD_MARGINS = &H2Const PSD_DISABLEPRINTER = &H20Const PSD_INTHOUSANDTHSOFINCHES As Long = &H4Const PSD_DISABLEPAPER As Long = &H200 Private Declare Function PageSetupDlg Lib "comdlg32.dll" _ Alias "PageSetupDlgA" (pPagesetupdlg As PageSetupDlg) As Long Private Declare Sub CopyMemory Lib "kernel32" _ Alias "RtlMoveMemory" _ (hpvDest As Any, _ hpvSource As Any, _ ByVal cbCopy As Long) Private Declare Function GlobalLock Lib "kernel32" _ (ByVal hMem As Long) As Long Private Declare Function GlobalUnlock Lib "kernel32" _ (ByVal hMem As Long) As Long Private Declare Function GlobalAlloc Lib "kernel32" _ (ByVal wFlags As Long, _ ByVal dwBytes As Long) As Long Private Declare Function GlobalFree Lib "kernel32" _ (ByVal hMem As Long) As Long Private Type POINTAPI x As Long Y As LongEnd TypePrivate Type RECT Left As Long Top As Long Right As Long Bottom As LongEnd TypePrivate Type PageSetupDlg lStructSize As Long hwndOwner As Long hDevMode As Long hDevNames As Long flags As Long ptPaperSize As POINTAPI rtMinMargin As RECT rtMargin As RECT hInstance As Long lCustData As Long lpfnPageSetupHook As Long lpfnPagePaintHook As Long lpPageSetupTemplateName As String hPageSetupTemplate As LongEnd TypePrivate Type DEVMODE_TYPE dmDeviceName As String * CCHDEVICENAME dmSpecVersion As Integer dmDriverVersion As Integer dmSize As Integer dmDriverExtra As Integer dmFields As Long dmOrientation As Integer dmPaperSize As Integer dmPaperLength As Integer dmPaperWidth As Integer dmScale As Integer dmCopies As Integer dmDefaultSource As Integer dmPrintQuality As Integer dmColor As Integer dmDuplex As Integer dmYResolution As Integer dmTToption As Integer dmCollate As Integer dmFormName As String * CCHFORMNAME dmUnusedPadding As Integer dmBitsPerPel As Integer dmPelsWidth As Long dmPelsHeight As Long dmDisplayFlags As Long dmDisplayFrequency As LongEnd Type Public Function ShowPageSetupDlg(frm As Form) As Boolean Dim DevMode As DEVMODE_TYPE Dim lpDevMode As Long Dim m_PSD As PageSetupDlg Dim bReturn As Integer On Error Resume Next 'Set the current orientation and duplex setting DevMode.dmDeviceName = Printer.DeviceName DevMode.dmFields = DM_ORIENTATION Or DM_DUPLEX' DevMode.dmPaperWidth = Printer.Width' DevMode.dmPaperLength = Printer.Height DevMode.dmOrientation = Printer.Orientation DevMode.dmPaperSize = Printer.PaperSize DevMode.dmDuplex = Printer.Duplex DevMode.dmSize = Len(DevMode) On Error GoTo 0 'Allocate memory for the initialization hDevMode structure 'and copy the settings gathered above into this memory m_PSD.hDevMode = GlobalAlloc(GMEM_MOVEABLE Or GMEM_ZEROINIT, Len(DevMode)) lpDevMode = GlobalLock(m_PSD.hDevMode) If lpDevMode > 0 Then CopyMemory ByVal lpDevMode, DevMode, Len(DevMode) bReturn = GlobalUnlock(m_PSD.hDevMode) End If With m_PSD .rtMargin.Top = 0.5 * 1000 .rtMargin.Bottom = 0.5 * 1000 .rtMargin.Left = 0.5 * 1000 .rtMargin.Right = 0.5 * 1000 .ptPaperSize.x = 14 * 1000 .ptPaperSize.Y = 8.5 * 1000 .lStructSize = Len(m_PSD) 'Set the structure size .hwndOwner = frm.hWnd 'Set the owner window .hInstance = App.hInstance 'Set the application instance .flags = PSD_MARGINS Or PSD_DISABLEPRINTER Or PSD_INTHOUSANDTHSOFINCHES End With 'Show the pagesetup dialog If PageSetupDlg(m_PSD) Then ShowPageSetupDlg = True' sngMarginTop = (m_PSD.rtMargin.Top) / 1000' sngMarginBottom = (m_PSD.rtMargin.Bottom) / 1000' sngMarginLeft = (m_PSD.rtMargin.Left) / 1000' sngMarginRight = (m_PSD.rtMargin.Right) / 1000' sngPageW = (m_PSD.ptPaperSize.x) / 1000' sngPageH = (m_PSD.ptPaperSize.Y) / 1000 ' Get DEVMODE structure from PRINTDLG lpDevMode = GlobalLock(m_PSD.hDevMode) CopyMemory DevMode, ByVal lpDevMode, Len(DevMode) Call GlobalUnlock(m_PSD.hDevMode) ' Set default printer properties On Error Resume Next If Not (Printer Is Nothing) Then Printer.Copies = DevMode.dmCopies Printer.Orientation = DevMode.dmOrientation Printer.PaperSize = DevMode.dmPaperSize' lPaperSize = DevMode.dmPaperSize Printer.PrintQuality = DevMode.dmPrintQuality End If On Error GoTo 0 End IfEnd Function
Thanks in advance for any insight!
**RESOLVED**Crystal Reports / Make Subreport Flow From Page To Page
I have a Crystal Report with a number of subreports. One of the details sections of the main report includes a subreport. I would like it if when I ran the report, it would allow the subreport to be split within several pages. Currently, the subreport shows up on page 2. I would like it to be split between pages one and two.
This is what makes this problem interesting. The subreport exists in the Details d section of the main report. Details d is not checked as Keep Together or New Page Before. The details section before Details d (Details c) is not checked for New Page After. If you go into edit subrebort for Details d, the Report Header has New Page Before checked off, but it is disabled (I can't change it).
How do I make this subreport flow across pages? Why is the Report Header section of my subreport checked for New Page Before but does not allow me to uncheck?
Crystal Reports - Cross Tab - Forcing Virtual Page On Every Page
I have created a crystal report which contains multiple detail sections (Da-Di). Each detail section contains a subreport, which contains a cross-tab.
I have done this because I need to create one excel spreadsheet which contains data from different types of cross tabs.
For example, one cross tab lists accounts and totals, the second lists accounts and totals by cost centre (17 of these), and a third lists accounts and totals by product group (11 of these).
I have lined up all the columns perfectly, and when I export to Excel (Data only), it works perfectly, and I get all the rows and columns of all the cross-tabs in one excel worksheet. Brilliant.
However, when I print, preview or export to pdf, I only see the "real" page and do not see any virtual pages that are shown in each of the sub-reports.
How can I print or view this from the main report and get the virtual pages as well, without stuffing up my export to excel?
Any suggestions would be greatly appreciated.
Tab Pages Lose Data Modifications When Switching From Page To Page
I have a Tabbed two-Page data entry and viewing form that allows the user to select a key from a listbox and view, delete, and alter 22 data items relating to the selected key. The list is bound to a dataset table. When the user selects an item in the listbox, all data (21 columns worth) relating to the key are displayed on the pages using the "rows().item()" feature to select the data from the dataset. The problem is, when I modify any of the data on one page and click on the other to modify more data, the data from the first page is reset to the original data. Is there a way to cause the tabpage feature to stop resetting the Key list selected index each time a different page tab is clicked? Thanks.
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!
|