> Thank you but when i click on button the print window will pop up. Sense i
> have 100 and more snp files in my folder, I have to click 100 times and
> more
> on 'Print' button. How can i avoid that??? Thank you
>
> Private Sub Command10_Click()
> On Error GoTo Command10_Click_Error
> Dim strPath As String
> Dim strFilter As String
>
> strPath = "C:\Notes\"
> strFile = Dir(strPath & "*.snp")
>
> Do While Len(strFile) > 0
> CreateObject("Shell.Application").Namespace(0).ParseName(strPath &
> strFile).InvokeVerb ("&Print")
> strFile = Dir()
> Loop
>
> Command10_Click_Error:
> MsgBox "Error " & Err.Number & " (" & Err.Description & ")"
> End Sub
> ---------------------------------------------------------------------------------
>
> "Douglas J. Steele" wrote:
>
>> You seem to be combining things that aren't intended to be combined!
>>
>> The function ahtAddFilterItem appears to be the function from
>>
http://www.mvps.org/access/api/api0001.htm at "The Access Web". It's
>> intended to be used with the rest of the code on that page, which is how
>> to
>> invoke the standard Windows File Open or File Save dialogues. On the
>> other
>> hand, the ParseName method is intended to create and returns a FolderItem
>> object that represents a specified item. I do not believe you can use
>> wildcards with it.
>>
>> Try:
>>
>> Dim strPath As String
>> Dim strFile As String
>>
>> strPath = "c:\Notes\"
>> strFile = Dir(strPath & "*.snp")
>> Do While Len(strFile) > 0
>> CreateObject("Shell.Application").Namespace(0).ParseName(strPath &
>> strFile).InvokeVerb ("&Print")
>> strFile = Dir()
>> Loop
>>
>> --
>> Doug Steele, Microsoft Access MVP
>>
http://I.Am/DougSteele>> (no e-mails, please!)
>>
>>
>> "JT" <JT[ at ]discussions.microsoft.com> wrote in message
>> news:4A6955DE-1E58-4630-9BCC-02A45217D802[ at ]microsoft.com...
>> > This code will print only file;
>> >
>> > CreateObject("Shell.Application").Namespace(0).ParseName("c:\Notes\Note1.snp").InvokeVerb
>> > ("&Print")
>> >
>> > I am trying to print all snp files and i keep getting error message
>> > ("object
>> > variable or With block variable not set"). What am i doing wrong?
>> >
>> >
>> > Dim strPath As String
>> > Dim strFilter As String
>> >
>> > strPath = "c:\Notes\"
>> > strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)")
>> >
>> > CreateObject("Shell.Application").Namespace(0).ParseName(strPath +
>> > strFilter).InvokeVerb ("&Print")
>> >
>> >
>> >
>> > Function ahtAddFilterItem(strFilter As String, _
>> > strDescription As String, Optional varItem As Variant) As String
>> >
>> > If IsMissing(varItem) Then varItem = "*.*"
>> > ahtAddFilterItem = strFilter & _
>> > strDescription & vbNullChar & _
>> > varItem & vbNullChar
>> > End Function
>> >
>>
>>
>>