Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Label Printing

Posted on 2003-10-23
22
457 Views
Last Modified: 2013-12-18
I know you guys are hungry for points, so here goes:

Does anyone know how to print a labal from a Notes database.

i.e We have a database here that some users need to print the name and address of chosen customers, this can be done by way of a view action or in the form direct.

Any ideas?
0
Comment
Question by:DavidAbbott
  • 6
  • 6
  • 4
  • +3
22 Comments
 

Author Comment

by:DavidAbbott
ID: 9605901
@~:
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 9605949
Well, you can create a special print form, and use the @command([fileprint]) command to use it to print from a view

@Command( [FilePrint] ; numCopies; fromPage; toPage; ifDraft; ifView; formName; breakType; ifReset; startDate; endDate)

The special print form will need to correspond to the label you want to print.  That may prove difficult, if you want to print on Avery style labels ...  Trial and error :-)

R6 has this as options in the standard (File/Print) options too..

cheers

Tom.
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 9605960
If you want 100% control over what you print, you'll need a 3rd party program (like Intelliprint,...) or you need to use Word / Excell/ Wordpro to do the actual printing.

That means creating a Word document using COM/OLE, putting in the data, and printing that using the Word VB Classes.

cheers,

tom
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 9

Expert Comment

by:Arunkumar
ID: 9606504
I have a beautiful code that will print mailing labels from notes application here it comes....
===============

Make changes to the field names and view name....
--------------
Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim v As NotesView
      Dim doc As NotesDocument
      Dim wordobj As Variant
      Dim firstname As Variant
      Dim midinit As Variant
      Dim lastname As Variant
      Dim fullname As String
      
      Dim addressone As Variant
      Dim addresstwo As Variant
      Dim fulladdress As String
      
      Dim citytown As Variant
      Dim mass As Variant
      Dim zip As Variant
      Dim citystatezip As String
      
      Set db = session.currentdatabase
      Set v = db.GetView("Informacion") 'NAME OF THE VIEW FROM WHERE U NEED TO EXPORT Mailing LABELS
      Set doc = v.GetFirstDocument
      
      wdCell = 12 'Microsoft Word VBA constant. Designates unit for table cell.
      tabc = 1 ' For controlling tabs
      AveryTemplate = "5160" ' Avery mailing label. Three across.
      Set wordobj = createobject("Word.Application.8") ' Launch Word.
      wordobj.visible = True ' Show Word.
      Call wordobj.documents.add 'Create new Word document.
      
' Create a new Word mailing label document. Use AveryTemplate variable declared at top.
      Call wordobj.MailingLabel.CreateNewDocument(AveryTemplate)
      Call wordobj.activate ' Give Word the focus.
      
' Cycle through each document in view.
' Create full address, then insert into Word table.
      
      Do Until doc Is Nothing
            fullname = doc.fullname(0) ' name of the person                        
            addressone = doc.GetItemValue("Address1") ' Address 1
            addresstwo = doc.GetItemValue("Address2") ' Address 2
            fulladdress = addressone(0) & Chr$(10) & addresstwo(0)
            
            
            citytown = doc.GetItemValue("CITY TOWN")  ' City town
            zip = doc.GetItemValue("ZIP") ' zip code
            citystatezip = citytown(0)  & " " & zip(0)
            
            Call wordobj.Selection.TypeText(fullname + Chr$(10)) ' Insert full name into Word.
            Call wordobj.Selection.TypeText(fulladdress + Chr$(10)) ' Insert full address into Word.
            Call wordobj.Selection.TypeText(citystatezip + Chr$(10)) ' Insert full address into Word.
            
            
' Tab Control
            If tabc <= 2 Then      
                  Call wordobj.Selection.MoveRight(wdCell) ' Move one cell to the right.
                  Call wordobj.Selection.MoveRight(wdCell) ' Move one cell to the right.
                  tabc = tabc + 1
            Else
                  Call wordobj.Selection.MoveRight(wdCell) ' Move one cell to the right.
                  tabc = 1
            End If
            
            Set doc = v.GetNextDocument(doc)
      Loop
End Sub
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 9606530
There you go, I  knew I needn't look for the code myself :-)

Tom
0
 
LVL 13

Expert Comment

by:CRAK
ID: 9606706
Ever heard of "IntelliPrint"? See http://www.cybernetsoft.com
I use it myself to print labels & enveloppes!
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 9606760
paid version ?
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 9606789
Yes, I've heard of it, that's why I proposed it in my first post waaaay on top.

0
 
LVL 14

Expert Comment

by:p_partha
ID: 9606904
Set wrdApp = CreateObject("Word.application")    
      wrdapp.documents.add
      wrdApp.Visible = True
      
      With wrdApp
            .Selection.Font.Name = "Verdana"
            .Selection.Font.Size = 12
            
            .selection.insertafter "Partha"
            
            .selection.insertparagraphafter                    
            
            .selection.insertafter "Myaddress "
            .selection.insertparagraphafter                    
            
            
            
            
            
            
            .selection.insertafter "Mycountry"
            .selection.insertparagraphafter                    
                        '.Selection.Font.Size = 10
                        '.Selection.Font.Bold=False
            
                        'If doc.Title1(0) <> "" Then
                        '.selection.insertafter doc.Title1(0)
                        '      .selection.insertparagraphafter                    
                        'End If
            
            .Selection.insertafter "Tel:  "
            .selection.insertafter "My number"
            .selection.insertparagraphafter                    
            
            .selection.insertparagraphafter    
            .selection.insertparagraphafter    
'                        .selection.moveright 12, 1, 0
      End With
      
      wrdApp.activate
      
      Exit Sub
      
ErrorHandler:      
      ErrNumber = Err
      If (Err=101) Then Resume Next
      
      Exit Sub    


This code can be modified to poitn to a view and then loopign for each entry...

Partha
0
 

Author Comment

by:DavidAbbott
ID: 9606946
what if the user only wants to print the current ui doc? and not from a view?
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 9606952
Did you check my code partha ? It uses the label format of Word ?

Trying to steal all my pts huh ?
0
 
LVL 14

Accepted Solution

by:
p_partha earned 500 total points
ID: 9606973
Aruns' code is good, it can be modified like this for uidoc , check for the fieldnames alone for now i have given test as the field name :
Sub Click(Source As Button)
      On Error Goto par
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim v As NotesView
      Dim doc As NotesDocument
      Dim wordobj As Variant
      Dim firstname As Variant
      Dim midinit As Variant
      Dim lastname As Variant
      Dim fullname As String
      
      Dim addressone As Variant
      Dim addresstwo As Variant
      Dim fulladdress As String
      
      Dim citytown As Variant
      Dim mass As Variant
      Dim zip As Variant
      Dim citystatezip As String
      
      Dim ws  As New notesuiworkspace
      Dim uidoc As notesuidocument
      Set uidoc = ws.currentdocument
      wdCell = 12 'Microsoft Word VBA constant. Designates unit for table cell.
      tabc = 1 ' For controlling tabs
      AveryTemplate = "5160" ' Avery mailing label. Three across.
      Set wordobj = createobject("Word.Application.8") ' Launch Word.
      wordobj.visible = True ' Show Word.
      Call wordobj.documents.add 'Create new Word document.
      
' Create a new Word mailing label document. Use AveryTemplate variable declared at top.
      Call wordobj.MailingLabel.CreateNewDocument(AveryTemplate)
      Call wordobj.activate ' Give Word the focus.
      Set doc = uidoc.document
' Cycle through each document in view.
' Create full address, then insert into Word table.
      
      
            fullname = doc.fullname(0) ' name of the person                    
            addressone = doc.test(0)' Address 1
            addresstwo = doc.test(0) ' Address 2
            fulladdress = addressone & Chr$(10) & addresstwo            
            
            citytown = doc.test(0)' City town
            zip = doc.test(0) ' zip code
            citystatezip = citytown & " " & zip
            
            Call wordobj.Selection.TypeText(fullname + Chr$(10)) ' Insert full name into Word.
            Call wordobj.Selection.TypeText(fulladdress + Chr$(10)) ' Insert full address into Word.
            Call wordobj.Selection.TypeText(citystatezip + Chr$(10)) ' Insert full address into Word.
            
            
' Tab Control
            If tabc <= 2 Then    
                  Call wordobj.Selection.MoveRight(wdCell) ' Move one cell to the right.
                  Call wordobj.Selection.MoveRight(wdCell) ' Move one cell to the right.
                  tabc = tabc + 1
            Else
                  Call wordobj.Selection.MoveRight(wdCell) ' Move one cell to the right.
                  tabc = 1
            End If
            
            Exit Sub
par:
      Msgbox "error occurred online numebr " & Erl
End Sub

0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 9606986
You can still use the 'change form' trick, but it won't work trough @command([fileprint]) directly

@Command([SwitchForm];"Test");
@postedCommand([FilePrint])

If you intend to use 1 of the scripts, just change the document they work on:

eg.
set uidoc = ws.currentdocument
set doc = uidoc.document

instead of looping thru the documents in the view

cheers,

Tom
0
 
LVL 13

Expert Comment

by:CRAK
ID: 9607328
Sorry Bozzie, I overread your comment!
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9611030
Actually, [FilePrint] accepts a paramater (I think it is around the fourth parameter?) to use an alternate form.  On eh down side, it causes it to print without prompting you for other printer settings, e.g., paper size.
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 9613958
Where are my points ?
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 9614144
Yes, qwaletee, I've said that too -  it doesn't work when the document is open (Parameter is ignored), though, that's why you should use [Switchform]


cheers,

Tom
0
 

Author Comment

by:DavidAbbott
ID: 9796128
Chaps, client never came back , so consider this one dead, thanks for the effort
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 9796578
If this is dead then how come partha is alive and running away with my points ???
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 9796581
And 2000 points for my code ???
0
 
LVL 14

Expert Comment

by:p_partha
ID: 9799458
Arun,
Do u want me to die for this 2000 points.. Not fair...

David,
Thx for the points ;-)


Partha
0
 

Author Comment

by:DavidAbbott
ID: 9802448
Arunkumar

Sorry mate, can give you some points if you want them!
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question