title image


Smiley Das papierlose Büro läßt grüßen ...
Hallo sunny,



ich nehme jetzt mal an, daß Du normaler User bist - keine Design-Rechte etc.



Dann gib Deinen DV-Leuten mal folgendes Script.



Habe ich irgendwo mal ausgegraben, also keine Garantie. Das muß dann in eine Schaltfläche der betreffenden Mail-Datenbank.



Beachte: Funkt nicht für PDF



Gruß

FPN60





Anhänge automatisch drucken



Surendra Kuamr Talluri

16 Jun 2000, Rating --- (out of 5)







This script will print all the .xls or .doc or .ppt attachments in selected

documents in a view. This is very useful in maildatabases. user doesn't need to

launch each attachment in each document. I am not very good at OLE. but while

helping a friend I came up with this script. If it needs any modification or

if any one have any better method please modify the script and post in this

forum.



Thanks.

Surendra Kumar Talluri



Code



Sub Initialize

Dim session As New notessession

Dim db As notesdatabase

Dim doc As notesdocument

Dim dc As notesdocumentcollection

Dim rtitem As notesrichtextitem

Dim loopindex As Long

Dim poc As Integer

Dim resul As String

Dim xlapp As Variant

Set db = session.currentdatabase

Set dc = db.Unprocesseddocuments

For loopindex = 1 To dc.count

Set doc = dc.getnthdocument(loopindex)

If (doc.hasitem("$File")) Then

Set rtitem = doc.getfirstitem("Body")

Forall eo In rtitem.embeddedobjects

If (eo.Type= EMBED_ATTACHMENT) Then

fname = "C:\TEMP\" & eo.Source

poc = Instr(1, fname, ".")

resul = Mid$(fname, poc, 4)



If Lcase$(resul) = ".xls" Then

Call eo.extractfile(fname)

Set xlapp = createobject("Excel.application")

xlapp.visible = True

xlapp.workbooks.open (fname)

Print("Printing Attachment : "&eo.Source)

Call xlapp.Activesheet.printout

' the follwing loop is to avoid any warning

message the 'application prompts some times like

" the current document is 'still in the

process of printing. do you want to continue printing

or 'cancel"

For i =1 To 100000

Next

Call xlapp.workbooks.close

Call xlapp.quit

End If

If Lcase$(resul) = ".doc" Then

Call eo.extractfile(fname)

Set xlapp = createobject("Word.application")

xlapp.visible = True

xlapp.documents.open(fname)

Print("Printing Attachment : "&eo.Source)

xlapp.PrintOut(FileName=fname)

For i =1 To 100000

Next

xlapp.Quit savechanges=False

End If

If Lcase$(resul) = ".ppt" Then

Call eo.extractfile(fname)

Set xlapp = createobject("PowerPoint.application")

xlapp.visible = True

xlapp.presentations.open(fname)

Print("Printing Attachment : "&eo.Source)

xlapp.ActivePresentation.PrintOut

For i =1 To 100000

Next

xlapp.activepresentation.close

xlapp.Quit

End If

End If

End Forall

Print(" ")

End If

Next

End Sub





Do you like this tip? Email your opinion or rate the tip:



geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: