Newsgroup: it.comp.appl.access
Titolo: seleziona e stampa file doc

Ho una stringa contenente i nomi dei file di una crtella del tipo c\:
cartella\ (spazio)file1,(spazio)file2,(spazio)file3
 dopo uno split ho questo vettore
Dim strArray() As String
   Dim intCount As Integer
   Dim strTest As String
   strTest = cmdlg_file
   strArray = Split(strTest, Chr$(0))
   For intCount = LBound(strArray) To UBound(strArray)
      Debug.Print Trim(strArray(intCount))
      Next
che mi restituisce
_______________________________
c\: cartella
file1
file2
ecc...
come posso inserire in nomi dei file in una tabella e poi stampare i
file stessi( i file sono lettere DOC)

budem...@libero.it
 ha scritto:

Al posto di Debug.Print fai una query INSERT
Ducmd.RunSql "INSERT INTO T1 (NomeFile) VALUES ('" &
Trim(strArray(intCount)) & "')"
ora se vuoi stamparli puoi usare la stampa Batch usando questo comando:
         Call PrintBatch(NomeFile, "", SW_HIDE, True)
Metti tutto in un Modulo poi passa alla funzione il nome file:
Private Type SHELLEXECUTEINFO
   cbSize As Long
   fMask As Long
      '0x00000001 (SEE_MASK_CLASSNAME) lpClass
      '0x00000003 (SEE_MASK_CLASSKEY) hkeyClass
      '0x00000004 (SEE_MASK_IDLIST) lpIDList
      '0x0000000c (SEE_MASK_INVOKEIDLIST)
      '0x00000010 (SEE_MASK_ICON) hIcon
      '0x00000020 (SEE_MASK_HOTKEY) dwHotKey
      '0x00000040 (SEE_MASK_NOCLOSEPROCESS)
      '0x00000080 (SEE_MASK_CONNECTNETDRV) lpName
      '0x00000100 (SEE_MASK_FLAG_DDEWAIT) DDE
      '0x00000200 (SEE_MASK_DOENVSUBST) lpDirectory
      '0x00000400 (SEE_MASK_FLAG_NO_UI)
      '0x00004000 (SEE_MASK_UNICODE) Unicode
      '0x00008000 (SEE_MASK_NO_CONSOLE)
      '0x00200000 (SEE_MASK_HMONITOR)
      '0x04000000 (SEE_MASK_FLAG_LOG_USAGE)
   hwnd As Long
   lpVerb As String
   lpFile As String
   lpParameters As String
   lpDirectory As String
   nShow As Long
   hInstApp As Long
   lpIDList As Long
   lpClass As String
   hkeyClass As Long
   dwHotKey As Long
   hIcon As Long
   hProcess As Long
End Type
Private Const SEE_MASK_NOCLOSEPROCESS = &H40
Private Const SEE_MASK_NO_CONSOLE = &H8000
Private Const SEE_MASK_CLASSKEY = &H3
Private Const SEE_MASK_IDLIST = &H4
Private Const SEE_MASK_CLASSNAME = &H1
Private Const SEE_MASK_INVOKEIDLIST = &HC
Private Const SEE_MASK_FLAG_DDEWAIT = &H100
Private Declare Function ShellExecuteEx Lib "shell32.dll" Alias
"ShellExecuteExA" (lpExecInfo As SHELLEXECUTEINFO) As Long
Public Enum LauncherDisplayMode
  SW_HIDE = 0
  SW_SHOWNORMAL = 1
  SW_SHOWMINIMIZED = 2
  SW_SHOWMAXIMIZED = 3
  SW_SHOW = 5
  SW_MINIMIZE = 6
  SW_SHOWMINNOACTIVE = 7
  SW_SHOWNA = 8
  SW_RESTORE = 9
  SW_SHOWDEFAULT = 10
End Enum
Public Enum LauncherCommand
  LC_OPEN = 0
  LC_EDIT = 1
  LC_PRINT = 2
  LC_PROPERTIES = 3
End Enum
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function WaitForSingleObject Lib "kernel32.dll" (ByVal
hHandle As Long, ByVal _
   dwMilliseconds As Long) As Long
Const INFINITE = &HFFFF
Const WAIT_TIMEOUT = &H102
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As
Long) As Long
Public Function PrintBatch(FileName As String, FileOptions As String,
DisplayMode As LauncherDisplayMode, Optional WaitEndOfProces As Boolean
= False) As Boolean
'
'-- lancia un'applicazione e restituisce un booleano che indica la
'   riuscita dell'operazione
--
'-- in caso di errore visualizza il relativo messaggio se ShowError è
True --
  Dim sei As SHELLEXECUTEINFO
  Dim RetVal As Long
  With sei
    .cbSize = Len(sei)
    .fMask = SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_FLAG_DDEWAIT Or
SEE_MASK_NO_CONSOLE
    .hwnd = GetDesktopWindow()
    .lpVerb = "PRINT"
    .lpFile = FileName
    .lpParameters = FileOptions
    .lpDirectory = ""
    .nShow = DisplayMode
  End With
  ' Open the file using its associated program.
  RetVal = ShellExecuteEx(sei)
  PrintBatch = (RetVal <> 0)
  If RetVal = 0 Then
    ' The function failed, so report the error.  Err.LastDllError
    ' could also be used instead, if you wish.
    Else
    If WaitEndOfProces Then
      '--- attesa ---
      ' Wait for the opened process to close before continuing. Instead
      ' of waiting once for a time of INFINITE, this example repeatedly
checks to see if the
      ' is still open.  This allows the DoEvents VB function to be
called, preventing
      ' our program from appearing to lock up while it waits.
      Do
        DoEvents
        RetVal = WaitForSingleObject(sei.hProcess, 0)
      Loop While RetVal = WAIT_TIMEOUT
      Call CloseHandle(sei.hProcess)
    End If
  End If
End Function
@Alex

 Trim(strArray(intCount)) & "')"
questa istruzione funziona  ma al posto del NomeFile io ho inserito il
campo della tabella

 campo della tabella
Beh mi sembrava OVVIO....!!!!
@Alex