?
Solved

VB AddIn, Code to HTML

Posted on 1998-06-30
3
Medium Priority
?
153 Views
Last Modified: 2010-05-03
Greetings,
I have never worked with an add in before, so I will make this as simple as
possible.
Hopefully, you shall have enough knowledge and patience to guide me.

I am looking to build a very simple add in,
One that shall take the current code inside a VB Form and
save it with the following...
<html>
<head>
<title> Name of form </title>
</head>
<body>

<xmp> or <pre>

Code inside the Visual Basic Form

</xmp> or <pre>
</body>
</html>

Please guide me threw this process,
will only award full points if it works.

Thank you,
S. McColgan

0
Comment
Question by:s_mccolgan
[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
  • 2
3 Comments
 
LVL 4

Expert Comment

by:tomook
ID: 1464652
Piece of cake. Here is the module in question. If you would like the entire working project, send you email address.

Option Explicit

Public GlobalInstance As VBIDE.VBE  ' Initialize this in Connect.OnConnection

Sub ShowComponentCode(sComponentName As String, sHTMLText As String)

    Dim myComponent As VBComponent
    Dim myProj As VBProject
    Dim myCodeModule As CodeModule
    Dim myCodePane As CodePane
       
    Set myProj = GlobalInstance.ActiveVBProject
    sHTMLText = ""
   
    On Error Resume Next
    Set myComponent = myProj.VBComponents(sComponentName)
    If Err.Number <> 0 Then
        ' No component of this name.
        Exit Sub
    End If
   
    sHTMLText = "<html>" & vbCrLf & "<head>" & myComponent.Name & vbCrLf
    sHTMLText = sHTMLText & "</head>" & vbCrLf & "<body>" & vbCrLf & "<xmp>" & vbCrLf
   
    Set myCodeModule = myComponent.CodeModule
   
    sHTMLText = sHTMLText & myCodeModule.Lines(1, myCodeModule.CountOfLines) & vbCrLf
   
    sHTMLText = sHTMLText & "</xmp>" & vbCrLf
    sHTMLText = sHTMLText & "</body>" & vbCrLf
    sHTMLText = sHTMLText & "</html>" & vbCrLf
End Sub


0
 

Author Comment

by:s_mccolgan
ID: 1464653
tomook,
here is my email address
s_mccolgan@hotmail.com

if you do send the sample project, please answer this question with
"Check your email"
I will be more than happy to award the rightfull points.

0
 
LVL 4

Accepted Solution

by:
tomook earned 400 total points
ID: 1464654
Check your email
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, 6 hours left to enroll

771 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