Question : Need help opening a MODI doc via Access 2003 VBA

I need for a user to be able to push a button on an Access form which will open a specific .mdi (MODI/Microsoft Office Document Imaging) file for viewing. Note: I don’t need to manipulate any of the OCR functions in MODI, I just need for the user to be able to open and view the images in the document. I’m using Access 2003 with Windows XP.

I downloaded the Microsoft Office Document Imaging Visual Basic Reference (http://www.microsoft.com/downloads/details.aspx?FamilyID=8f93e445-b1cf-4477-a373-e17417d616bc&displaylang=en). This was only mildly helpful, as I’m a novice and don’t have a deep understanding of how the various methods and objects work together.

I added a reference to Microsoft Office Document Imaging 11.0 Library, which says it contains the the viewer control. There is also mention on various forums about “registering the viewer control”, but no step-by-step instructions on how to do this (if it’s even necessary).

The below code seems to be hanging up on MiDocView1. First I got a “user type not defined” error and now I’m getting runtime 424 “object required.”  What am I missing? Can someone please help?

Thanks,
Jay
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
Private Sub cmdViewFile_Click()

Dim miDoc As MODI.Document
Dim myViewer As MODI.MiDocView
Dim strPath As String
Dim strFileName As String

strPath = “C:\Documents\Subfolder\”
strFileName = “SpecificFileName.mdi”

Set miDoc = New MODI.Document
miDoc.Create (strPath & strFileName)

Set miDoc = New MODI.Document
miDoc.Create (strPath & strFileName)

'This line successfully copies the file to a new location, so I know some of the code works:
    'miDoc.SaveAs strPath & strFileName & "_COPY.mdi", miFILE_FORMAT_MDI

'But when I try to simply open the original file to view it,
'I get runtime error 424: object required, at this point in the code.
    Set myViewer = MiDocView1
    myViewer.Document = miDoc
    'I've also tried:  myViewer.Filename = strPath & strFileName

Set miDoc = Nothing
Set myViewer = Nothing

End Sub

Answer : Need help opening a MODI doc via Access 2003 VBA

Hy JaySpike,

Find the attached picture to see how to register your control assuming that the file is present in the given path

regsvr32 "C:\Program Files\Common Files\Microsoft Shared\MODI\11.0\MDIVWCTL.DLL"

Anyway, It seems like there is a windows xp security update is blocking the Viewer Control, so, find that information in the below mentioned link, the second link describe how to rectify the problem (Only if you have installed the mentioned security update)

1). Problematic security update information - http://support.microsoft.com/kb/973507
2). How to rectify - http://support.microsoft.com/kb/978153/

let us know
 
How to register a control
How to register a control
 
Random Solutions  
 
programming4us programming4us