Print Page Word Problem
I create page dynamically from vb using bookmarks and print it. But sometimes depending on valume of data, word creates two pages and print them out, BUT SECOND PAGE IS BLANK, how do I avoid it ??? Thank you, All!
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
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
Problem With Print, Page Setup, And Print Preview In A Text Editor...
Yes, I have another question.
When I use these exact same functions (with WebBrowser.ExecWB in place of txtScrapbook.Text) in my web browser, it works perfectly. But when I use them in reference to a text box, it doesn't.
Can you tell me where the problem lies, or give me an alternative method? I have a common dialog box already for other functions, so feel free to make use of it if you need to. Thanks.
Code:Private Sub PageSetup_Click()
txtScrapbook.Text OLECMDID_PAGESETUP, OLECMDEXECOPT_DODEFAULT
'opens page setup dialog
End Sub
Private Sub Print_Click()
txtScrapbook.Text OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER
'opens common dialog box prompting user to print current web page/parts of current web page
End Sub
Private Sub PrintPreview_Click()
txtScrapbook.Text OLECMDID_PRINTPREVIEW, OLECMDEXECOPT_DODEFAULT
'opens print preview dialog
End Sub
How To Print Images That Fit To The Page Size Specified In Print Common Dialog?
i need some help in printing the whole image tat fit onto the paper size i specified in Print Common Dialog. I hav a PictureBox array & each PictureBox contains a smaller Picturebox inside. For example : Picture1(index) has a smaller Picture2(index) inside. There are vertical & horizontal scrollbars next to each Picture1(index).
i already hav the basic Print Common Dialog code below. Here's the problem -> I can print out the pictures displayed inside Picture2(index) but the printout will turn out truncated or just part of the whole picture when im printing to a 4R photo size for example and the image displayed in Picture2(index) is larger then the bounding Picture1(index) & i need to use the scrollbars to scroll and view the other portions of the image.
So how to modify the code below to print out the whole image tat fit nicely to the paper size i specified. Thanxs.
'---------------------------------------------------------------------
'CODE
'---------------------------------------------------------------------
CommonDialog1.CancelError = True
On Error Resume Next
CommonDialog1.Action = 5 ' Start the Print Common Dialog
If (Err.Number = cdlCancel) Then Exit Sub
'when Cancel is pressed, exit subroutine
'Code to print the array here
For Pics = Picture2.LBound To Picture2.UBound
If Picture2(Pics).Picture > 0 Then ' If the PictureBox is not empty
Printer.PaintPicture Picture2(Pics).Picture, 0, 0
Printer.EndDoc
End If
Next
'---------------------------------------------------------------------
Print Picture Box (print A Form That Is Too Large For The Screen Or Page)
I got a picture box (Picture1), which contain several picture box'es, labels and
Flex Grid tables, -which I would like to print. Picture1 is quite high (higher than the screen). I found some code that i modified, but the printing only get the labels proper. The Flex Grids and picture box'es only show the border, and not the contents.
Code:Private Const WM_PAINT = &HF
Private Const WM_PRINT = &H317
Private Const PRF_CLIENT = &H4& ' Draw the window's client area.
Private Const PRF_CHILDREN = &H10& ' Draw all visible child windows.
Private Const PRF_OWNED = &H20& ' Draw all owned windows.
Private Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Private Sub Print_Click()
Dim rv As Long
Me.ScaleMode = vbTwips ' default
With Picture2
.Top = Picture1.Top
.Left = Picture1.Left
.Width = Picture1.Width
.Height = Picture1.Height
End With
Me.Visible = True
DoEvents
Picture1.SetFocus
Picture2.AutoRedraw = True
rv = SendMessage(Picture1.hwnd, WM_PAINT, Picture2.hDC, 0)
rv = SendMessage(Picture1.hwnd, WM_PRINT, Picture2.hDC, _
PRF_CHILDREN + PRF_CLIENT + PRF_OWNED)
Picture2.Picture = Picture2.Image
Picture2.AutoRedraw = False
Printer.Print ""
Printer.PaintPicture Picture2.Picture, 0, 0
Printer.EndDoc
End Sub
Edited by - Zigar on 11/27/2003 3:31:21 AM
Print Column Header On Each Print Out Page
I am trying to put the header of each column on each print out page.
Right now I have it only appearing on the first page of my printouts.
How do you do that in Excel 2003?
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
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
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
HELP Print Listview Print To Many Page
HI
I am using this to print Listview
When I print 1 page then it is ok but
if data from Listview go on 3 or 4 page then fyrst page is ok
efter fyrst page I only get 1 data on on each page
so this can be many page
Can somone help me what is wrong in this ??
Printer.Font = "Tahoma"
Printer.FontBold = True
Printer.FontUnderline = False
Printer.FontSize = 10
Printer.Print "Print from listview"
Printer.FontUnderline = False
Printer.Print vbNewLine
Printer.CurrentX = 1440
Printer.CurrentY = 1440
PrintListView lvwDataCopy
Printer.EndDoc
Private Sub PrintListView(lvw As ListView)
Const Margin = 60
Const COL_MARGIN = 240
Dim ymin As Single
Dim ymax As Single
Dim xmin As Single
Dim xmax As Single
Dim num_cols As Integer
Dim column_header As ColumnHeader
Dim list_item As ListItem
Dim i As Integer
Dim num_subitems As Integer
Dim col_wid() As Single
Dim X As Single
Dim y As Single
Dim line_hgt As Single
xmin = Printer.CurrentX
ymin = Printer.CurrentY
' ******************
' Get column widths.
num_cols = lvw.ColumnHeaders.Count
ReDim col_wid(1 To num_cols)
' Check the column headers.
For i = 1 To num_cols
col_wid(i) = _
Printer.TextWidth(lvw.ColumnHeaders(i).Text)
Next i
' Check the items.
num_subitems = num_cols - 1
For Each list_item In lvw.ListItems
' Check the item.
If col_wid(1) < Printer.TextWidth(list_item.Text) _
Then _
col_wid(1) = Printer.TextWidth(list_item.Text)
' Check the subitems.
For i = 1 To num_subitems
If col_wid(i + 1) < _
Printer.TextWidth(list_item.SubItems(i)) _
Then _
col_wid(i + 1) = _
Printer.TextWidth(list_item.SubItems(i))
Next i
Next list_item
' Add a column margin.
For i = 1 To num_cols
col_wid(i) = col_wid(i) + COL_MARGIN
Next i
' *************************
' Print the column headers.
Printer.CurrentY = ymin + Margin
Printer.CurrentX = xmin + Margin
X = xmin + Margin
For i = 1 To num_cols
Printer.CurrentX = X
Printer.Print FittedText( _
lvw.ColumnHeaders(i).Text, col_wid(i));
X = X + col_wid(i)
Next i
xmax = X + Margin
Printer.Print
line_hgt = Printer.TextHeight("X")
y = Printer.CurrentY + line_hgt / 2
Printer.Line (xmin, y)-(xmax, y)
y = y + line_hgt / 2
' Print the rows.
num_subitems = num_cols - 1
For Each list_item In lvw.ListItems
X = xmin + Margin
' Print the item.
Printer.CurrentX = X
Printer.CurrentY = y
Printer.Print FittedText( _
list_item.Text, col_wid(1));
X = X + col_wid(1)
' Print the subitems.
For i = 1 To num_subitems
Printer.CurrentX = X
Printer.Print FittedText( _
list_item.SubItems(i), col_wid(i + 1));
X = X + col_wid(i + 1)
Next i
y = y + line_hgt * 1.5
Next list_item
ymax = y
' Draw lines around it all.
Printer.Line (xmin, ymin)-(xmax, ymax), , B
X = xmin + Margin / 2
For i = 1 To num_cols - 1
X = X + col_wid(i)
Printer.Line (X, ymin)-(X, ymax)
Next i
End Sub
Print A Page Without My Print Button!!!
My question concern my web page:
How can i print an html page without it's print button.
I figure out how to hide the button when pressed(with layers)
but when it's finish printing or the user cancel,
how can i make the button visible,i know how but on
what event.
some1 have an idea??
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.
Word 2000: Delete A Word Page With VBA
I have a Word 2000 Template that has a bunch of bookmarks and a Data Entry Form, that the user creates a New Document off of. When the user creates a new document based on this template, there is a Macro that the user can run that loads a user entry Form allowing the user has to enter data. When the user clicks the OK button on the form the following 2 things happen:
1. All the bookmarks within the document get updated based on data from the User Entry Form
2. At the end of the document, a particular Word document (Test.doc) is inserted at the "Attachment" bookmark
Everything works fine the first time the user clicks the OK button. However, if the user reruns the same macro within the same document, re-enters different data on the user entry form and clicks the OK button, all the bookmarks update properly, but the inserted file gets added after the 1st one (the 1st one does not get cleared out) - so the user has 2 inserted files. For instance, the first time the user runs the letter there is 3 pages (2 pages + 1 File), and if the user runs it again, there will be 4 pages (2 pages + 2 Files - 1st one and now the 2nd one), and so on... Basically, each time the user clicks the OK button, the appropriate file keeps getting appended to the end.
My problem is, how can I remove the file (Test.doc) that was inserted on the 1st run before we insert the file on the 2nd run? Is there a way to delete the entire page before we insert the file, that way all the data is cleared leaving me with only 2 pages, before I do my insert? My sample code of inserting the file is below:
Dim bmRange As Range
' This is my bookmark where I want to add the file
Set bmRange = ActiveDocument.Bookmarks("Attachment").Range
With bmRange
.Collapse Direction:=wdCollapseEnd
' Insert a Page Break after the bookmark so that file being inserted is on it's own page
.InsertBreak Type:=wdPageBreak
' Insert the Test Document
.InsertFile FileName:="C:Test.doc", Range:="", _
' ConfirmConversions:=False, Link:=False, Attachment:=False
.Collapse Direction:=wdCollapseEnd
End With
Word VBA / Macro Problem With Print & Browser (Word 2000)
I am trying to use a macro inside the AutoOpen() event of a Word doc so that when the Word doc is opened inside IE, it will print the Word doc then close both the Word doc and the IE window. For some reason, VBA loses its reference to the doc object and IE Application object after the PrintOut line is executed. I have tried things like:
Sub AutoOpen()
MyWord.Visible = False
MyWord.ActiveDocument.PrintOut
MyWord.ActiveDocument.Close False
End Sub
or:
Sub AutoOpen()
With ActiveDocument
.PrintOut Background:=False
.Close savechanges:=False
.Parent.Quit
End With
End Sub
or:
Sub AutoOpen()
Dim MyWord As Object
Set MyWord = GetObject(, "Word.Application")
Dim IE As Object
Dim IEDoc As Object
Set IE = GetObject(, "InternetExplorer.Application")
Set IEDoc = MyWord.ActiveDocument
IEDoc.PrintOut
IEDoc.Close
IE.Quit
End Sub
But whatever I try, the Word doc prints, then throws a 4605 error about the method or property not being available because the document is in another app. Any ideas?
Thanks,
Chris
Extract Each Word From A String And Print One Word Per Line.
I have a textbox that contains a string(can be any number of words).
How do i extract each word from the string and
print one word per line onto the form? e.g.
textbox:
Hi can someone please help me
Print to form:
Hi
can
someone
please
help
me
Thanks
Excel Closes, But Word Doesn't! And Word Won't Print!
Hello:
My code needs to open Excel, populate a table with data, mail-merge that table with a Word document, and finally print the merged documents. I have two problems:
1) As the program finishes, Excel closes and is removed from the Task Manager's Processes list, but Word is not removed. I've tried the .Quit method for both (even accounting for Word's use of parameters), but "WINWORD.EXE" remains on the list even after "EXCEL.EXE" is removed. I also set my objects to Nothing in Class_Terminate, but still no luck - and putting the .Close/.Quit procedures under Class_Terminate gave me an error. I know Excel is working because the program is saving my .xls files, but I'm not sure about Word. Which leads to...
2) Obviously I'm only opening Word to merge the file - the text of the document itself never changes so it doesn't need to be saved, just linked to the data source (the Excel table just created). But I can't get Word to print! I set the .ActivePrinter property and used .PrintOut but no luck. What do I have wrong here? Thanks for any insight.
Jeff W.
Owen, Little and Assoc., Inc.
Beachwood, NJ
P.S. This code runs from within ArcMap, a digital-mapping software package. Hence all of the "ICommand"s and "IMap"s and such, the use of "ISelectionSet" to populate the Excel table, etc. All of the code pertaining to ArcMap works fine - it's mostly just the part at the end of the code relating to Word where there must be something I'm doing wrong.
Code:Option Explicit
Implements ICommand
Private m_pApp As IApplication
Private m_pMxDoc As IMxDocument
Private m_pMap As IMap
Private m_pExt As IExtension
Private m_pFeature As IFeature
Private m_pFeatureLayer As IFeatureLayer
Private m_pFeatureCursor As IFeatureCursor
Private m_pFeatureSelection As IFeatureSelection
Private m_pSelectionSet As ISelectionSet
Private m_pFields As IFields
Private m_pField As IField
Private m_pRow As IRow
Private m_pCursor As ICursor
Private m_pQBLayer As IQueryByLayer
Private m_pBitmap As IPictureDisp
Private m_pAppExcel As New Excel.Application
Private m_pWorkbook As Excel.Workbook
Private m_pWorksheet As Excel.Worksheet
Private m_pAppWord As New Word.Application
Private m_pDocument As New Word.Document
Private m_pMailMerge As MailMerge
Private Sub Class_Initialize()
Set m_pBitmap = LoadResPicture(101, vbResBitmap) 'Button icon
End Sub
Private Sub Class_Terminate()
Set m_pApp = Nothing
Set m_pMxDoc = Nothing
Set m_pMap = Nothing
Set m_pExt = Nothing
Set m_pFeature = Nothing
Set m_pFeatureLayer = Nothing
Set m_pFeatureCursor = Nothing
Set m_pFeatureSelection = Nothing
Set m_pSelectionSet = Nothing
Set m_pFields = Nothing
Set m_pField = Nothing
Set m_pRow = Nothing
Set m_pCursor = Nothing
Set m_pQBLayer = Nothing
Set m_pBitmap = Nothing
Set m_pAppExcel = Nothing
Set m_pWorkbook = Nothing
Set m_pWorksheet = Nothing
Set m_pAppWord = Nothing
Set m_pDocument = Nothing
Set m_pMailMerge = Nothing
End Sub
'
'ICommand members
'
Private Property Get ICommand_Bitmap() As esriSystem.OLE_HANDLE
ICommand_Bitmap = m_pBitmap
End Property
Private Property Get ICommand_Caption() As String
ICommand_Caption = "200' List"
End Property
Private Property Get ICommand_Category() As String
ICommand_Category = "Extending ArcObjects"
End Property
Private Property Get ICommand_Checked() As Boolean
ICommand_Checked = False
End Property
Private Property Get ICommand_Enabled() As Boolean
ICommand_Enabled = True
End Property
Private Property Get ICommand_HelpContextID() As Long
End Property
Private Property Get ICommand_HelpFile() As String
End Property
Private Property Get ICommand_Message() As String
ICommand_Message = "Creates a 200' list for selected property and generates an Excel file (for mail merge)"
End Property
Private Property Get ICommand_Name() As String
ICommand_Name = "ExtendingArcObjects_200FootList"
End Property
Private Property Get ICommand_Tooltip() As String
ICommand_Tooltip = "Create a 200' list"
End Property
Private Sub ICommand_OnCreate(ByVal hook As Object)
Dim a As New UID
Set m_pApp = hook
a.Value = "CmdToolbarExt.clsLaunchExtension"
Set m_pExt = m_pApp.FindExtensionByName("200FootListExtension")
End Sub
Private Sub ICommand_OnClick() ''MAIN BUTTON
Dim a As Long 'Field (i.e. column) value
Dim b As Long 'b-d: counters
Dim c As Long
Dim d As Long
Dim lMaxSize(8) As Long 'Width of each field
Dim sValue As String 'Current record's value (string)
Dim lHolder As Long 'Temp. field width value
Dim sFieldName(8) As String
Dim sBlock As String
Dim sLot As String
Dim sFirstRecord As String 'Holds IDNum of 1st selected record
Dim sFileName As String
sFieldName(0) = "IDNum"
sFieldName(1) = "Block"
sFieldName(2) = "Lot"
sFieldName(3) = "FULLNAME"
sFieldName(4) = "ADDRESS"
sFieldName(5) = "CITY"
sFieldName(6) = "STATE"
sFieldName(7) = "ZIP"
sFieldName(8) = "PROPLOC"
Set m_pMxDoc = m_pApp.Document
Set m_pMap = m_pMxDoc.FocusMap
Set m_pFeatureLayer = m_pMxDoc.FocusMap.Layer(0) '!!Change to reflect name
Set m_pFeatureSelection = m_pFeatureLayer ' of parcel layer!!
Set m_pCursor = m_pFeatureLayer.Search(Nothing, False)
'Create Excel file name
Call m_pFeatureSelection.SelectionSet.Search(Nothing, False, m_pFeatureCursor)
Set m_pFeature = m_pFeatureCursor.NextFeature
sFirstRecord = "Block" & m_pFeature.Value(m_pFeature.Fields.FindField("Block")) & "Lot" & _
m_pFeature.Value(m_pFeature.Fields.FindField("Lot"))
Set m_pQBLayer = New QueryByLayer
With m_pQBLayer 'Select all parcels within 200 feet
Set .ByLayer = m_pFeatureLayer ' of the selected parcel
Set .FromLayer = m_pFeatureLayer
.BufferDistance = 200
.BufferUnits = esriFeet
.ResultType = esriSelectionResultAdd
.LayerSelectionMethod = esriLayerSelectWithinADistance
.UseSelectedFeatures = True
Set m_pFeatureSelection.SelectionSet = .Select
End With
Set m_pSelectionSet = m_pFeatureSelection.SelectionSet
Call m_pSelectionSet.Search(Nothing, False, m_pCursor)
Set m_pFields = m_pCursor.Fields
Set m_pRow = m_pCursor.NextRow
m_pMxDoc.ActiveView.Refresh
'*******************************mostly ArcMap code above this line************
'*******************************mostly VBA code below this line***************
Set m_pAppExcel = CreateObject("excel.application") 'Create Excel instance
Set m_pWorkbook = m_pAppExcel.Workbooks.Add 'Create workbook/worksheet
Set m_pWorksheet = m_pWorkbook.Sheets.Add(After:=m_pWorkbook.Sheets(m_pWorkbook.Sheets.Count))
Cells(1, 1).Value = "IDNumber" 'Field names
Cells(1, 2).Value = "Block"
Cells(1, 3).Value = "Lot"
Cells(1, 4).Value = "Name"
Cells(1, 5).Value = "Address"
Cells(1, 6).Value = "City"
Cells(1, 7).Value = "State"
Cells(1, 8).Value = "ZIP"
Cells(1, 9).Value = "Property Loc."
m_pAppExcel.DisplayAlerts = False 'Kill first three sheets
Worksheets("Sheet1").Delete
Worksheets("Sheet2").Delete
Worksheets("Sheet3").Delete
m_pAppExcel.DisplayAlerts = True
m_pWorksheet.Activate
m_pWorksheet.Name = "200 Foot List"
m_pWorksheet.Rows(1).Font.Bold = True
c = 1
d = 1
Do While Not m_pRow Is Nothing 'Grab values from selection set
c = c + 1
For b = 0 To 8
a = m_pFields.FindField(sFieldName(b))
m_pWorksheet.Cells(c, d).Value = m_pRow.Value(a) 'Write value to record
sValue = m_pRow.Value(a)
If c = 2 Then 'Find the longest entry in each field
lMaxSize(b) = Len(sValue)
Else
lHolder = Len(sValue)
If lHolder > lMaxSize(b) Then
lMaxSize(b) = lHolder
End If
End If
d = d + 1
Next b
Set m_pRow = m_pCursor.NextRow
d = 1
Loop
If lMaxSize(0) < 10 Then lMaxSize(0) = 10 'Minimum widths for fields
If lMaxSize(1) < 6 Then lMaxSize(1) = 6
If lMaxSize(2) < 4 Then lMaxSize(2) = 4
If lMaxSize(3) < 6 Then lMaxSize(3) = 6
If lMaxSize(4) < 8 Then lMaxSize(4) = 8
If lMaxSize(5) < 4 Then lMaxSize(5) = 4
If lMaxSize(7) < 6 Then lMaxSize(7) = 6
If lMaxSize(8) < 13 Then lMaxSize(8) = 13
m_pWorksheet.Columns("A").ColumnWidth = lMaxSize(0) 'Set field widths
m_pWorksheet.Columns("B").ColumnWidth = lMaxSize(1)
m_pWorksheet.Columns("C").ColumnWidth = lMaxSize(2)
m_pWorksheet.Columns("D").ColumnWidth = lMaxSize(3)
m_pWorksheet.Columns("E").ColumnWidth = lMaxSize(4)
m_pWorksheet.Columns("F").ColumnWidth = lMaxSize(5)
m_pWorksheet.Columns("G").ColumnWidth = lMaxSize(6)
m_pWorksheet.Columns("H").ColumnWidth = lMaxSize(7)
m_pWorksheet.Columns("I").ColumnWidth = lMaxSize(8)
sFileName = "C:200FootList_" & sFirstRecord & ".xls"
Call m_pWorksheet.SaveAs(sFileName) 'Save Excel file (for this instance)
m_pAppExcel.DisplayAlerts = False
Call m_pWorksheet.SaveAs("C:200FootListMerger.xls") 'Save dummy copy of Excel file
m_pAppExcel.DisplayAlerts = True ' for mail merge (always overwrites)
Call m_pWorkbook.Close
Call m_pAppExcel.Application.Quit 'Quit Excel
Set m_pAppWord = CreateObject("word.application") 'Create Word instance
m_pAppWord.ActivePrinter = "\DellserverSHARP407 on Ne04:"
'Open document for mail merge
Set m_pDocument = m_pAppWord.Documents.Open("C:MailMerge.doc")
Call m_pDocument.MailMerge.OpenDataSource("C:200FootListMerger.xls")
m_pDocument.MailMerge.Destination = wdSendToNewDocument
m_pDocument.MailMerge.Execute
Call m_pDocument.PrintOut 'Print letters
Call m_pDocument.Close
Call m_pAppWord.Application.Quit(False) 'Quit Word
End Sub
Print Page That Contains Last Value
Hi,
I am using VB6 to access an excel document. What I want to do is find the last value of a range (a1:a100) and print only the page that the last value appears on.
Example:
Say the last value in that range is in cell a79, and a79 appears on the third page of the file, vb6 now only prints page 3 (which contains a79).
I hope that makes sense and that you are able to assist me.
Thanks again.
Daniel.
Page Set Up Before Print
Hi All,
Glad to be the member of this Forum.
Is it possible to make "Page 1 of ?" option as the default footer in Page Set up. That is every I shouldn't be selecting the option before printing.
Please help.
Thanx
Print A A4 Page
I have two fields in my database
They are :name and ID
The original layout is:
Name ID
Tom 1
Mike 2
Jack 3
Allan 4
I would like to print it like:
Name ID Name ID
Tom 1 Jack 3
Mike 2 Allan 4
anyone knows ? thank you !!! thank you !
Keep asking question until the end of the world....
Help Please With 2 Page Print Out.
Ok I am new to VB6 and I ran into a problem. When I print out a report from a text box the report ends up being 2 pages which it is suppose to be, but here is the problem. The first page prints out fine with a top margin of about 1/2 inch, but the second page looses the top margin data and prints the first line of the second page about 2 mm from the top of the page instead of 1/2 inch top margin.
I just want the second page to have the 1/2 top margin also what do I need to do?
here is my code so far.
Private Sub cmdPrint_Click()
'USE API TO PRINT
If (DisplayPrinter(txtReport.hWnd, centerForm:=True)) Then
Printer.ScaleLeft = -0.5 * 1440 'left margin
Printer.ScaleTop = -0.5 * 1440 'top margin
Printer.CurrentX = 0
Printer.CurrentY = 0
Printer.Font = "ARIAL"
Printer.FontSize = 12
Printer.Print txtReport.Text
Printer.EndDoc
MsgBox "Report has printed successfully."
End If
End Function
any suggestions or code would really be appriciated. Please make it as simple as possiable, since I am really new at vb6 thanks,
Print On New Page
Hello i have 2 questions, my first one is how do i print to my printer?
I think its something like Print.Printer but im not sure.
For my second question: i know that there is a code that when i add it it will print automaticly to a new page on my printer even when the page isnt full yet. I thought it was something like Chr12 to print on a new page but i forgot what it was. Hope anyone can help me out here.
Print New Page
I would like to know, How I can print the picture and put the picture in a new page after print the contents in the listview?
Code:
For i = 1 To ListView1(0).ListItems.Count
Printer.Print Tab(5); ListView1(0).ListItems(i); _
Tab(25); ListView1(0).ListItems(i).ListSubItems(1); _
Tab(45); ListView1(0).ListItems(i).ListSubItems(2); _
Tab(65); ListView1(0).ListItems(i).ListSubItems(3); _
Tab(85); ListView1(0).ListItems(i).ListSubItems(4); _
Tab(105); ListView1(0).ListItems(i).ListSubItems(5); _
Tab(125); ListView1(0).ListItems(i).ListSubItems(6); _
Tab(145); ListView1(0).ListItems(i).ListSubItems(7)
Next
Printer.Print "Legend": ForeColor = vbBlack
Set Picture2 = LoadPicture(App.path & "output.bmp")
Printer.PaintPicture Picture2, 60, 13000, 2000, 800
Printer.EndDoc
Print A Web Page
How to print a web page pogramatically from within Vbcode? (The web page should not appear on the screen ie. it should be loaded in background or in a web control)
Print 1st Page Of PDF
How do I Print the 1st page of a PDF? I currently use:
VB Code:
ShellExecute(hDesktop, "Print", "somefilename.pdf", vbNullString, "C:",0)
but it prints it all when I just want the first page.
thanks
---edit---
the program used Crystal Report Application server, so i just used the export feature to word and used the word application object to print page 1, but thanks for all of the interest.
Help. How To Print More Than 1 Page ?
Hi peeps, i have 2 probs.
Im new and have spent days on this forum learning all that i have learned so far.
THANKS ALL
After much searching i have finally found how to print the contents of my msflexgrid.
I have 2 problems that i am hoping your goodselfs can help with.
1. ) The data i have in the flexgrid is more than 1 page but can not get the rest to print. how can i get the printer to manually feed the next page and continue printing. ??
current code i am using is.
Private Sub Command5_Click()
Printer.ColorMode = vbPRCMMonochrome
Printer.PrintQuality = vbPRPQDraft
Printer.Orientation = vbPRORLandscape
Printer.PaintPicture Grid1.Picture, 0, 0
Printer.EndDoc
End Sub
2. ) Less inportant.
whilst printing the flexgrid, i would like to print in the background my logo so it is like a hologram. ?
Not sure if this can be done with the print command or if it can be included into the msflexgrid as a background image.
Hope you can help.
Thanks.
Print The Web Page
Working with the printer is a pain...
I had an idea to display what I wish to print as a web page in a hidden webbrowswer and the tell that webbrowser to print
webbrowser1.print
but there is not print method
there must be a way!
Print Fit To Page
Hi, I have an Access database and I've created a print button on one of my forms. When I click print it prints on 2 pages and I want to squeeze it onto 1 page. I can do this by adjusting the page setup but I want to do it in the visual basic code somehow so that all the users won't have to change their page setup. I've searched everywhere and can't find an answer to my problem, can someone please help?
Print From A Web Page
Hi,
I have a web site. I have a listing of all the word documents on the web site with a selection box for each. When I select some docs and click Print Button, I need to print all those docs onto a local printer ?
Can I use VB script for that ? If so, how ? Thanks for your help,
Cuteguy141.
How To Print At Last Page
hi......
can anyone please explain how to print the page footer only at the final page in data report (VB 6)
for example,
l've 3 page report n i only want the total of sales print at final page, Page 3 only.
TQ.....
Print First Page Of Doc
I need to change the printer settings in order to print the first page of a pdf file. Here is my print code, what can i do to make it print just the first page.
strPrinterName = Printer.DeviceName
strDriverName = Printer.DriverName
strPortName = Printer.Port
'Perform error checking
strCommandLine = "c:Program FilesAdobeAcrobat4.0 ReaderAcroRd32.exe /t """ + _
strfilename + """ """ + _
strPrinterName + """ """ + _
strDriverName + """ """ + _
strPortName + """"
RunProcess strCommandLine
thanks
JM
Print Web Page
Do u know: how to print a web page? To print it in text format (html codes) and graphic format(like we see in web browser). I have a hard time to figure it here. Could u help? Thanks!!!
Print Two Forms On One Page
How do I get two forms under the same project to print on a letter size page?
The print button is initialized from Form1 which collects the info. Form2 & 3 are formatted just for printing. This is all a standard exe file.
Any help would be apprciated.
Print Web Page Oddity
IE.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, 0, 0
This works fine except it will print one extra blank page. When I change it to prompt the user only one page is printed. I removed the header and footer for both and they are the same webpage. Any ideas as to why not prompting the user would result in an extra blank page being printed?
Thanks,
Mark
Print First And Last Page In Excel
I am trying to build a macro in VB to print out only the first and last page of Excel reports that I produce. Is there anything that returns the last page?
Print Page Size Help
i am using printer.print
how do i tell the computer i want to print to Legal size????
Printer.PaperSize
but what is the answer for legal?
How To Print 2 Forms In One Page?
HI my problem is the following
I need to print one form and it´s duplicate in one page. I tried to copy and paste the entire form, but the size exceds the size permited by visual basic 6.
Thanks in advance
Webpage: Print To Fit One Page
Hi,
I have a program that loads a web page into a WebBrowser Control. I can print it fine using the following code:
Code:
wWeb.SetFocus
wWeb.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, 0, 0
I would like to print the page to fit to one page. I have tried printer.ScaleWidth = 8.5, and tried various printer.zoom values, but nothing works. Does anybody have any ideas?
Ryan
Print Heading Every Page
Hi! I can print a heading only in my first page. How would I print the same heading in every page and how do i print page numbering Like "Page 1 of N". What should be added to my code?
VB Code:
Printer.FontName = "Courier New" Printer.FontSize = 11 Printer.Orientation = vbPRORPortrait Printer.CurrentY = 720 'Top Margin of .5" Printer.Print Tab(60); "Date Printed: "; Date Printer.Print Tab(60); "Served by: "; lblLoginName.Caption Printer.Print Tab(60); "Transaction ID: "; txtTransactionID.Text 'Printer.FontUnderline = True Printer.Print: Printer.Print Dim Pagelength%, BottomMargin%, TopMargin% Pagelength = 11 * 1440 BottomMargin = 1 * 1440 TopMargin = 0.5 * 1440 'Print headers If Printer.CurrentY > Pagelength - BottomMargin Then Printer.NewPage Printer.CurrentY = TopMargin End If
Vb Want Print My Excel Page.
Hello people,
I'm trying to find the vb code to print a page out of a excel file.
VB Code:
Spreadsheet3.XMLURL = App.Path & " est.xls"Spreadsheet3.ActiveWorkbook.Sheets("Blad3").SelectSpreadsheet3.ActiveWindow.SelectedSheets.PrintOut Copies:=1
I get everytime a error on PrintOut with the message Method or data member not found.
What is wrong and is there somebody who can help me with the correct line.
Print A Html Page
Hello, Iwas just wondering how to print a html page from within an app. I have created one from my app and now want to send it to the printer. Is ther any way of doing this.
How To Use PaintPicture To Print More Than One Page
I have a picBOx that has fairly large text documents being printed to it. I can view the entire pic box but when I send it to the printer it only prints out one page!?!?!?
Any ideas?
Also, what is the maximum height of a PicturBox?
Print Form Fit Exactly To A A4 Page
how do i print a form that can fit (or fill up the whole page) a A4 size page?..cuz when i print the form it prints only half the page ....
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.
Print Full Page
I am having trouble printing a form from my program. When I print a form, it only prints what is above the fold. My forms are quite long (about twice the length of the screen) and I would like to print the entire form..not just what is above the fold. Can someone let me know if it is possible to print the full page of a long form.
Thanks,
Al
How Do I Print A Page That Is 8x11
OK here is the problem i am faced with, i need to put a 1040 ez form on to my form, but i need it to stay about its original size. That is not a problem for me to do. The problem is, when i print the form, it never prints the entire 1040ez. Is there a way for me to do this, well, I know there is a way i just don't know how to.
Can anyone please help me with this????
|