Solved

Vb Tool

Posted on 2004-09-13
5
316 Views
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...
0
Comment
Question by:deepu712
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
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
Handler:
   ' 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
0
 

Author Comment

by:deepu712
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.
0
 
LVL 6

Expert Comment

by:DominicCronin
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.

0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

705 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

15 Experts available now in Live!

Get 1:1 Help Now