Advertisement

10.10.2007 at 11:18AM PDT, ID: 22884937
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.6

Create VB 6.0 AddIn

Asked by cybeh in Visual Basic Programming, Miscellaneous Programming

Tags: , ,

Hi,

I am trying to create a VB 6.0 Addin by using VB itself

I do have 2 problems here
1. How to get the current active project, active form?
    Set p = VBInstance.ActiveVBProject
    Set c = p.VBComponents.Item("Form1") <- I could only hardcode this, but no idea how to dynamically get the current active project active form.

2. Whenever there is a button click, it will close the form.
=========================================================
Public VBInstance As VBIDE.VBE
Public Connect As Connect

Option Explicit

Private Sub CancelButton_Click()
    Connect.Hide
End Sub


Private Sub Command1_Click()
    UpdateTag
End Sub

Private Sub Form_Load()
   Dim c As VBComponent
   Dim p As VBProject
   Dim vbc As VBControl
   Dim vbf As VBForm
   Dim sc As String
   Dim sp As String
   Dim svbc As String
   
    Set p = VBInstance.ActiveVBProject
    Set c = p.VBComponents.Item("Form1")
   
    List1.Clear
   
    If c.Type = vbext_ct_VBForm Then
        c.Activate
        Set vbf = c.Designer
        For Each vbc In vbf.VBControls
            'MsgBox vbc.Properties("name")
           List1.AddItem vbc.Properties("name")
           List1.ItemData(List1.NewIndex) = IIf(IsNumeric(vbc.Properties("tag")), vbc.Properties("tag"), 0)
        Next vbc
    End If

End Sub

Private Sub UpdateTag()
   Dim c As VBComponent
   Dim p As VBProject
   Dim vbc As VBControl
   Dim vbf As VBForm
   Dim sc As String
   Dim sp As String
   Dim svbc As String
   
    Set p = VBInstance.ActiveVBProject
    Set c = p.VBComponents.Item("Form1")
   
    If c.Type = vbext_ct_VBForm Then
        c.Activate
        Set vbf = c.Designer

        For Each vbc In vbf.VBControls
            If vbc.Properties("name") = List1.List(List1.ListIndex) Then
                vbc.Properties("tag") = Text1.Text
                Exit For
            End If
   
        Next vbc
    End If

End Sub

Private Sub List1_Click()
    Text1.Text = List1.ItemData(List1.ListIndex)
End Sub


==============================================================

When I click on the command button1, it will execute the code inside, and auto close the frmAddIn.
May I know how can I make it remain open? (I didn't write any code to hide it of close it)

Thanks.

Start Free Trial
 
Loading Advertisement...
 
[+][-]10.10.2007 at 12:03PM PDT, ID: 20051319

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Basic Programming, Miscellaneous Programming
Tags: vb, addin, create
Sign Up Now!
Solution Provided By: angelIII
Participating Experts: 1
Solution Grade: B
 
 
[+][-]10.10.2007 at 05:13PM PDT, ID: 20053385

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.10.2007 at 09:36PM PDT, ID: 20054320

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.10.2007 at 09:44PM PDT, ID: 20054341

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.10.2007 at 09:57PM PDT, ID: 20054379

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.10.2007 at 10:02PM PDT, ID: 20054396

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.15.2007 at 02:52PM PST, ID: 20293425

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628