[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Word 97 and Visual Basic 4.0 16 bit

Posted on 2000-03-23
6
Medium Priority
?
210 Views
Last Modified: 2013-11-25
I am using Visual Basic 4.0, 16 bit, and have Word97 installed on the same machine. I'm able to open Word and insert a metafile, while the Visual Basic program is running, without any problems.
If I try to programmatically open Word and insert the same metafile, Word crashes with an Invalid Page Fault. I only have 32M of RAM on this machine. Am I asking too much from the hardware, or is there something different about vb 4.0 16 bit code? Is there something about the OLE I need to change? I noticed that on a machine with both VB4.0 16 bit, and VB 6.0 installed, it works (running 4.0) I will attach the small code segment...

Set NewDoc = CreateObject("word.application")
NewDoc.Documents.Add
NewDoc.Visible = True

With NewDoc.selection
    .inlineshapes.addpicture filename:="C:\hpgraph.wmf", linktofile:=False, savewithdocument:=True
   
0
Comment
Question by:jscharpf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 

Author Comment

by:jscharpf
ID: 2650769
I forgot.

It opens word ok, but crashes at the line that inserts the picture.

Jeff
0
 
LVL 1

Expert Comment

by:pclement
ID: 2650877

Somewhat perplexing. Are you using early or late binding on the Word object?

In other words if you are declaring NewDoc as Word.Application, try using late binding and declaring NewDoc as Object.

This is just a stab in the dark, but early binding sometimes fails between 16 and 32-bit COM objects.
0
 

Author Comment

by:jscharpf
ID: 2651116
pclement
Thanks for the response.

I declared NewDoc as Object (globaly) in the declarations section.
Was I to do this before or after declaring newdoc as word.app?

Jeff
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 1

Expert Comment

by:georgeman
ID: 2651468
jscharpf
I tested your source code on my PC and it works fine in environment: VB4 16-bit, Word 97.
I only added:
End With

I have no idea why it crashed on you PC.
Did you try use Word.Basic instead Word.Application ?

Regards
George
0
 
LVL 1

Accepted Solution

by:
pclement earned 300 total points
ID: 2651716
ischarpf:

Declare it as Object first and then use CreateObject to create the instance:

Dim NewDoc as Object

Set NewDoc = CreateObject("Word.Application")

Like I said, I'm not sure if this will work, but give it a try and see if it makes any difference.

 
0
 

Author Comment

by:jscharpf
ID: 2661939
Thanks,
I re-installed everything, but only installed VB4.0 16 bit. It seems to work ok.

Jeff
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

649 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