s_mccolgan
asked on
VB AddIn, Code to HTML
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
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
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Option Explicit
Public GlobalInstance As VBIDE.VBE ' Initialize this in Connect.OnConnection
Sub ShowComponentCode(sCompone
Dim myComponent As VBComponent
Dim myProj As VBProject
Dim myCodeModule As CodeModule
Dim myCodePane As CodePane
Set myProj = GlobalInstance.ActiveVBPro
sHTMLText = ""
On Error Resume Next
Set myComponent = myProj.VBComponents(sCompo
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)
sHTMLText = sHTMLText & "</xmp>" & vbCrLf
sHTMLText = sHTMLText & "</body>" & vbCrLf
sHTMLText = sHTMLText & "</html>" & vbCrLf
End Sub