Vb Tool

Posted on 2004-09-13
Last Modified: 2012-08-14
1) Can Someone please let me know how to convert word document into power point and vice versa using vb6.
2) Any idea how to make a vb tool to get the trace of your vb exe and related dll(like sql trace).it sould give the  trace of flow and tell clearly where application is failing(dll or exe).I have been ask to write such tool for one of my application as it keeps on failing and we always break our head to find out where its failing...
Question by:deepu712
  • 2

Accepted Solution

DominicCronin earned 500 total points
ID: 12093017
First question:

Word and Powerpoint both have APIs that can be accessed from VB6. On a machine with VB6 and Office installed, create a new VB programme, and add references to "Microsoft Word 10.0 Object Library" and "Microsoft Powerpoint 10.0 Object Library". (That's how it looks on my system, but if you've got a different version of Office, the numbers will be different.)

Having done that, you can create or open up Word and Powerpoint documents and access the contents. A good starting point is to hit F2 and explore the methods you can call. The object model starts with "Application" in both cases. If you haven't got any experience with writing this kind of code, it's also very useful to practice writing macros in each application. Check out the Tools|Macro menu in Word and Powerpoint. The documentation is pretty good, but you'll need to spend a fair amount of time with it. The Microsoft Office website is also a very valuable resource, and you might even be able to download some sample code.

Second question:

The usual technique for this is to instrument the application itself by writing proper error handlers. If you write every method with its own error handler, the error handler can add information about the method to the error and then re-throw it. By the time the error reaches the "top" you have built an error stack that indicates exactly what went wrong. Of course, if your application doesn't have this already, it can be quite a lot of work, but you can get a lot of benefit just from adding very standard error handlers using some text processing tools to fix up the top and bottom of each method. Something like this

Sub Blah()
On Error Goto Handler
' You can also have a routine that outputs trace information to the system event log, a database,  a text file, or a debugger etc.
#If TRACE Then
    Call Trace("Start: Blah")
#End if

' method body here

Exit Sub
   ' re-raise will get err.description, add to it and then use that to call err.raise
   Call ReRaiseError(err, "Blah")

End Sub

End Sub

Author Comment

ID: 12155250
Hi Domi,
             Appreciat your reply.
  First Question:
          I already tried this option, the main problem i am facing in copying from word to power point is
           how and when to insert a new power point slides(new page).
  Second Quesion:
          Dll has not been created by me and sadly my manager doesn't want me to write same dll
         (we dont have source)again,instead of that he wants me to find out some tools to track out the flow of
        the programe.

Expert Comment

ID: 12162954
Recording a quick powerpoint macro gives:

ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Add(Index:=2, Layout:=ppLayoutText).SlideIndex

You might have to fiddle with it a bit, but that's how it's done. (You can probably miss out the GotoSlide part)

As for "when", that's trickier. If the Word documents are already laid out as slides, with suitable outlining and styles, then it should be reasonably straightforward. Otherwise, you'll have to come up with an algorithm based on the size of text etc. I'm actually having trouble trying to imagine what sort of documents you have to work with here. There aren't many kinds of word documents that it would make sense to convert to powerpoint.

As for the tracing issue. Firstly, what's the point? If you haven't got the source, what will you do if you *do* manage to find out where it's broken? Frankly, I would have to say that the best way to solve your problem is to educate your boss. There are very few options if you don't have the sources. Perhaps if there's an unhandled exception, you might be able to attach a debugger when it breaks, but that won't tell you much, except where in the dll or exe it's breaking.

Presumably if you haven't got the source, it's a dll made by someone else. The only people who can meaningfully do anything for you are the people who made it, and therefore have the source.


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
changePi Challenge 15 103
allStar challenge 1 51
C# DataGridView_RowsAdded event not firing 1 63
Windows and other UI names - The Proper names for the Various elements! 1 55
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

947 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

22 Experts available now in Live!

Get 1:1 Help Now