Solved

VB AddIn, Code to HTML

Posted on 1998-06-30
3
149 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
  • 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 100 total points
ID: 1464654
Check your email
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

831 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