Make exe file for excel vba code-VBForums
Results 1 to 6 of 6

Thread: Make exe file for excel vba code

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2007
    Posts
    132

    Make exe file for excel vba code

    I am using the following codes and working well with excel. How can I use this code in vb6 to make an exe file so that the same need to be installed to use the code?
    In a standard module:
    Code:
    Public Sub Inf1()
    On Error GoTo endo:
        Dim cell As Range
        Dim mFormat As String
        For Each cell In Selection
            If cell.Value > 0 Then
                mFormat = "[>=10000000]#\,##\,##\,##0;[>=100000]##\,##\,##0;##,##0"
            ElseIf cell.Value < 0 Then
                If cell.Value >= -99999 Then
                    mFormat = "(#,##0);(#,##0)"
                Else
                    mFormat = "[<=-10000000](#\,##\,##\,##0);[<=-100000](##\,##\,##0);(##,##0)"
                End If
            End If
                    If cell.Value = 0 Then
                        mFormat = "0;;-"
                        cell.HorizontalAlignment = xlRight
            End If
            cell.NumberFormat = mFormat
            Next cell
    endo:
    End Sub
    In another standard module:
    Code:
    Sub aa()
        Application.OnKey "%r", "Inf1"
    End Sub
    In This Workbook module:
    Code:
    Private Sub Workbook_Open()
    Dim objCmdBrPp As CommandBarPopup, oSubMenu As CommandBarPopup
    ' 7 - index of Data menu
    ' you can find Data menu by enumerating all controls
    Set objCmdBrPp = Application.CommandBars("Worksheet Menu Bar").Controls(7)
    
    Set oSubMenu = objCmdBrPp.Controls.Add(Type:=msoControlPopup, before:=objCmdBrPp.Controls.Count, temporary:=True)
    
    
    Dim objCmdBtn As CommandBarButton
    Set objCmdBtn = objCmdBrPp.Controls.Add(Type:=msoControlButton, temporary:=True)
    
    With objCmdBtn
       .Caption = "Indian Numbe&r Format"
       .OnAction = "Inf1"
    End With
        
    Set objCmdBtn = Nothing
    End Sub

  2. #2
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,162

    Re: Make exe file for excel vba code

    You should just make an xla addin for excel by using excel.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Star Wars Gangsta Rap Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 300 GB HDs, 2 GBs DDR2 667 MHz RAM, 2 Viewsonic 24" LCDs, Windows 7 SP-1/Windows 8.1, Office 2010, VS 2013

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2007
    Posts
    132

    Re: Make exe file for excel vba code

    yeah this I have made as an addin but I want to make it an exe file How that can be done?

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    20,093

    Re: Make exe file for excel vba code

    si the geek has a tutorial for converting vba to vb6
    main thing is to make all ranges as part of the vb6 object that contains them
    dim ranges, sheets or workbooks as objects
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2007
    Posts
    132

    Re: Make exe file for excel vba code

    Thanks westconn1 for the reply I have searched the forum and also the posts by si the greek But couldnot find the tutorial Could you please provide the link?

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    20,093

    Re: Make exe file for excel vba code

    i found the link in his signature
    http://www.vbforums.com/showthread.php?t=391665
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.