Print all snapshots in a folder

iansl2000

New member
Local time
Yesterday, 21:10
Joined
Mar 27, 2009
Messages
4
Hello,
I have a piece of code that prints all .rtf's in a folder via Word. I'd now like to do the same thing with snapshot files.
Can anyone tell me how I can change the code to do this
Thanks in advance
Ian
Code:
Function PrintDoc1()
   Dim WordObj As Object
   Set WordObj = CreateObject("Word.Application")
   ' The path to obtain the files.
   sMyDir = "X:\PurchaseOrders\OrdersAuthByPIN\"
   sDocName = Dir(sMyDir & "*.rtf")
   While sDocName <> ""
      ' Print the file.
      WordObj.Documents.Open sMyDir & sDocName
   WordObj.PrintOut Background:=False
      ' Get next file name.
      sDocName = Dir()
   Wend
   WordObj.Quit
   Set WordObj = Nothing
End Function
 
For anyone needing this in the future here is how I got there.
1. Create a form with the snapshot viewer actvex control on it. Call the control 'THeNameOftheSnapshotCOntrol'

2.Now create a button nand on the onclick event put the following code
Private Sub Command1_Click()

Code:
Dim stThisFile As String
  
  
  sMyDir = "G:\Everyone\PurchaseOrders\OrderImagesTemp\"
sDocName = Dir(sMyDir & "*.snp")
 While sDocName <> ""
stThisFile = sMyDir & sDocName
'MsgBox (stThisFile)
  
Me.THeNameOftheSnapshotCOntrol.SnapshotPath = stThisFile


Do While Me.THeNameOftheSnapshotCOntrol.Object.ReadyState <> 4
  
DoEvents
  
Loop
  
Me.THeNameOftheSnapshotCOntrol.PrintSnapshot False
sDocName = Dir()
   Wend
End Sub

Click the button and the reports print out.

Most of the credit for this solution from http://www.eggheadcafe.com/forumarchives/AccessmodulesdaoVisualBasica/Oct2005/post24131030.asp
 

Users who are viewing this thread

Back
Top Bottom