You are currently offline, waiting for your internet to reconnect

BUG: InsertObjDlg Method Fails with "Unable to Access Source" Error Message

This article was previously published under Q291103
This article has been archived. It is offered "as is" and will no longer be updated.
You can use the InsertObjDlg method of the OLE container control to create an object from a file. However, if the file name contains any extended ASCII characters (that is, characters with the values 0 through 31 and 127 through 255), InsertObjDlg fails, and you receive the following error message:
Error 31039
Unable to access source document
This error occurs even though the file closes in the operation system.
Before OLE container control checks whether the file name that you provided is valid, it converts all of the characters in the file name from the American National Standards Institute (ANSI) character set to the OEM character set. With extended ASCII characters in the file name, the converted file name is no longer the same as the original file name. Because the converted file name is not available in the system, OLE container control reports an error.
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

Note You must have a Visual Studio license agreement to obtain this hotfix.

To resolve this problem, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question. The English version of this fix should have the following file attributes or later:
   Date        Time     Version     Size    File name   -----------------------------------------------------   17-Apr-2001 12:05PM   1.42MB  Msvbvm60.dll   17-Apr-2001 12:05PM  1.64MB  VBA6.dll   17-Apr-2001 12:05PM   1.86MB  VB6.exe				

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

Steps to Reproduce Behavior

  1. In the Visual Basic Integrated Development Environment (IDE), create a Visual Basic Standard EXE project. Form1 is created by default.
  2. Add an OLE container control to the form. Keep the default name OLE1.
  3. Add the following code to the code window of Form1:
        Private Sub OLE1_Click()        OLE1.InsertObjDlg    End Sub					
  4. Press the F5 key to run the project.
  5. Click the OLE container control.
  6. In the Insert Object dialog box, click Create from File.
  7. In the Insert Object dialog box, click Browse, and select a file that uses extended ASCII characters in the file name. For example:
    "Caf.doc" (where "" is ASCII 130)
  8. In the Insert Object dialog box, click OK. You receive the above-mentioned error message.
error 31039

Article ID: 291103 - Last Review: 02/27/2014 21:07:29 - Revision: 3.2

Microsoft Visual Basic 6.0 Enterprise Edition, Microsoft Visual Basic 6.0 Professional Edition, Microsoft Visual Basic 6.0 Learning Edition

  • kbnosurvey kbarchive kbbug kbqfe kbpending KB291103