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
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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
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?????
VB + WORD.. Get Page Count..
hi,
how to get the pagecount of a word document ??
i am using a reference to word
and using itz obj, i am trying to get it ..!
i can get the character count but ...
how to get the pagecount..
please help...
....................................
Page Count In Word
Program creates pages dynamically,
I inserted page number in Word Page,
How do I display programmatically in the footer something like 'Page 1 of 10' ?
Thank Ya all !
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
Word Automation - Insert A Page
Hi,
I know I should not be working on the day before chrismas, it is so exciting. But I have this problem. I am using Word Automation. I can open a instance of word and open a document (which has 10 pages). I want to insert a new page after ever page in my opened document. Dose anyone know how to loop through everpage in a document.
Thanks,
Chris
Have a great wee Chrismas.
Word Count In Summary Of Property Page
Anyone know how to access the word count for a .doc on the summary tab of the files properties? I need to get the word count and the line count. I dont want to have to open the file up and count them, so there has to be someway of grabbing the numbers from the summary tab on the properties page.
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.
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
Returning A Page Count?
Hi,
I'm trying to get the 'Partial' page count for a sheet.
The sheet has a print area set and I'm trying to count the Horizontal Page Breaks.
I've found this in the MS Help, but it doesn't appear to work..
Code:
For Each pb in Worksheets(1).HPageBreaks
If pb.Extent = xlPageBreakFull Then
cFull = cFull + 1
Else
cPartial = cPartial + 1
End If
Next
MsgBox cFull & " full-screen page breaks, " & cPartial & _
" print-area page breaks"
Has anyone got any ideas, or possibly achieved it?
Regards
Count # Page Within Document?
Help..
Any one know how to count the number of page within a document?
Thank you..
Edited by - kunkhmer on 11/24/2003 3:08:21 PM
DAta Report Page Count
Hi Friends,
How to return the total number of pages in Data Report.
I want to display at the page footer "Page number(%p) of NumberofPages ". How to do this
Thanks
VbBaby
Page Count In Crystal Reports
I am using Crystal Reports with VB. CRViewer control is used. I want to know the number of pages so that I can disable the Next and previous buttons on my tool bar. The standard tool bar which comes with CRViewer will do it automatically. But I am using my own tool bar and want to disable the Next and Prev buttons as per the page count.
Can you pls give a suggestion on how to get the page count?.
Thanks & Regards
Ravi
How To Count Lines Per Page In Crystal Report 7.0
Dear Sir/Madam,
I am using crystal report 7.0. I want to calculate no.of lines per page. Some of these lines may be blank. I want to have a formula which will increment line counter by 1 as soon as it prints one line on page.
How do I Proceed ?
Is it possible in crystal report ?
Can I get the source code for it ?
Please Help me out.
Thanks in advance.
Automatic Printer Page Count Program
is it possible to make an automatic program that automatically counts the total pages the printer have already printed?
i want the program to count and store the number of pages each time the printer prints any document and can be viewed if the user wants to check how many pages have his printer printed.
my printer doesnt have this program so i've planned to make this but i dont know the codes!
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!
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.
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?
<| <-- --> |>
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?
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.
|