Solved

Windows Picture/Fax Viewer-VBA solution & ?

Posted on 2004-08-10
8
1,242 Views
Last Modified: 2008-01-09
The following code accomplishes opening the Windows Picture & Fax Viewer, to a point. Hope part 1 helps someone else:

If UserForm1.OptionButton4.Value = True Then
For k = 0 To 8 Step 1
If ArrayList3(k).Value = True Then
Set fso = New FileSystemObject
Set objFile = fso.GetFile("" & drive & ":\ClientDocs\" & filename & _
"\" & filename & "" & ArrayList2(k) & "\" & filename & "" _
& ArrayList1(k) & ".jpg")
Shell "rundll32.exe C:\WINNT\System32\shimgvw.dll,ImageView_Fullscreen " & _
"" & objFile & "" '"c:\ClientDocs\AbelDanielle\AbelDanielleDDForm\AbelDanielleDD.jpg"
End If
Next k
End If

The routine loops through finding the auto "checked" .jpg images on file and lo and behold the Viewer opens and flahes through the 4 (in my test case) files...my question is this: after the 4th image appears, the "back" arrow does not bring up image 3,2 or 1...how do I get the viewer to remember the 1st three images? Would this be done via an array of some type? Hey, at least I got this far!

Thanks,
Ron
0
Comment
Question by:ronaldj
  • 4
  • 3
8 Comments
 
LVL 7

Accepted Solution

by:
jacobhoover earned 100 total points
ID: 11768627
All teh images are located in a different directory.. So I belive you are out of luck with this approach.  I belive the viewer is just showing you the current objects in the folder it can understand.  I think you would have to copy the images to a temp directory for browsing, if you are required to use the MS Viewer.  You could also just use an Image or Picture control to display the pictures on your own form.  Then you could just have an array of file names w/ complete paths and an index to hold the current location with 2 command buttons for next and previous.
0
 

Author Comment

by:ronaldj
ID: 11768689
Basically agree, maybe this is even simpler. Here's what I did: with OptionButton4=true, Delete files routine (& KillProperly) are run to empty the content of c:\DocView...

If UserForm1.OptionButton4.Value = True Then
Sub DeleteFiles()
' DeleteFiles Macro
' Macro recorded 8/10/2004 by ronald j. usauskas
'Loop through all the files in the directory by using Dir$ function
Dim MyDKFile As String
MyDKFile = Dir$("c:\DocView\*.*")
Do While MyDKFile <> ""
    KillProperly "c:\DocView\" & MyDKFile
    'need to specify full path again because a file was deleted 1
    MyDKFile = Dir$("c:\DocView\*.*")
Loop
End Sub

Public Sub KillProperly(Killfile As String)
    If Len(Dir$(Killfile)) > 0 Then
        SetAttr Killfile, vbNormal
        Kill Killfile
    End If
End Sub
'******************************************
now, with the CopyFile included and the reference to C:\DocView, works just great!

For k = 0 To 8 Step 1
If ArrayList3(k).Value = True Then
Set fso = New FileSystemObject
Set objFile = fso.GetFile("" & drive & ":\ClientDocs\" & filename & _
   "\" & filename & "" & ArrayList2(k) & "\" & filename & "" _
   & ArrayList1(k) & ".jpg")
fso.CopyFile "" & objFile & "", "c:\DocView\"
End If
Next k
UserForm1.Hide
Shell "rundll32.exe C:\WINNT\System32\shimgvw.dll,ImageView_Fullscreen " & _
"c:\DocView"
0
 
LVL 7

Expert Comment

by:jacobhoover
ID: 11768712
Any further questions?
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:ronaldj
ID: 11768757
Kinda think I answered my own question didn't I.
0
 
LVL 7

Expert Comment

by:jacobhoover
ID: 11768771
Actually, I gave you two suggestions as you had not well defined what exactly the requirement was and then you made the decision as to which of the two choices you prefered and went with it.  No arguments, but you application is now working as I stated it would. =/
0
 

Author Comment

by:ronaldj
ID: 11768886
I really do appreciate your input. The solution I came up with was about an hour after I posted my original query. Yes, you gave me 2 suggestions but the "deed" was already done. I think this is verified by your suggestion vs my response(in code) time. Heck, if could program that quick (or type for that matter) I wouldn't need to be on this board! I think you deserve something for your interest and response...I'm new to this, how do I give you "something" of the 250 points?
0
 
LVL 7

Expert Comment

by:jacobhoover
ID: 11777334
I would agree to a reduced number of points.  The issue is is that I saw a question and I responded to it.  If in further instances you solve you own question, you have to come out here and cancel it or you are committed into responding.  As far as reducing the points, I am not sure but you could always post a request for the reduced value and let it sit untill it goes "stale"
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

813 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now