Advertisement

08.17.2000 at 10:02AM PDT, ID: 11034201
[x]
Attachment Details

Object OLE. I can't open in binary mode

Asked by VMontalvao in VB Controls, Microsoft Programming

Tags: ole, vb6

I have a VB6 form with an OLE object that create/open/edit/save Word files.

The code:

'--------------- BEGIN --------------------------

Private Sub cmdEdit_Click()
    OLE1.DoVerb vbOLEShow
End Sub

Private Sub cmdSave_Click()
    OLE1.SaveToFile OLE1.FileNumber
End Sub

Private Sub cmdNew_Click()
    OLE1.Close
    OLE1.CreateEmbed "", "Word.Document.8"
    OLE1.SourceDoc = "abc.doc"
    OLE1.Refresh
End Sub

Private Sub cmdExit_Click()
    OLE1.Close
    OLE1.Delete
    Unload Me
End Sub

Public Sub OpenFile(ByVal sFile As String)
    OLE1.CreateEmbed sFile
    OLE1.FileNumber = 1
    OLE1.DoVerb vbOLEOpen
End Sub

'---------------- END -----------------------

My problem is when I save an opened file appears a run time error (31036 -
Error saving file).
Explanation of this error:

- Visual Basic can't write the object to the specified file (set Action =
11, or 18). Possible causes:

    1 -The FileNumber property is invalid.
    2 -The specified file wasn't opened in Binary mode.
    3 -There isn't enough disk space.

In my case only option 2 maybe valid.
Does anyone know how can I open a file in Binary mode using the OLE Object?

Thx
Start Free Trial
[+][-]08.17.2000 at 02:19PM PDT, ID: 3973779

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.18.2000 at 03:34AM PDT, ID: 3978120

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.31.2000 at 07:10PM PST, ID: 5016306

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.02.2000 at 03:37AM PST, ID: 5049320

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: VB Controls, Microsoft Programming
Tags: ole, vb6
Sign Up Now!
Solution Provided By: VMontalvao
Participating Experts: 2
Solution Grade: A
 
 
[+][-]11.02.2000 at 08:55PM PST, ID: 5068419

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]11.02.2000 at 08:55PM PST, ID: 5068420

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.02.2000 at 08:55PM PST, ID: 5068422

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32