Consulting

Results 1 to 9 of 9

Thread: Convert a .vbp to .exe program

  1. #1
    VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location

    Convert a .vbp to .exe program

    Mvidas has tried to help me with this (thanks Matt) but I guess I don't understand how to do it. Basically I have a .vbp module that needs to be converted to an executable so it can be scheduled to be run at night instead of by me during the day because it ties up my machine for a few hours which keeps me from getting to other work i have to do. I have attached the code for your convenience. Any help is appreciated.

    [VBA] Option Base 0
    Option Compare Text
    Option Explicit
    Type SQLserverSvcCodeSvcTypeType 'SVT_REPORT_SVC_CODE_SVC_TYPE_INTNL

    ReportColumnOrder As Variant
    SVC_CODE As Variant
    SVC_CODE_DESC As String
    SVC_TYPE As Variant
    SVC_TYPE_DESC As String
    End Type
    Type SQLserverMSDataType 'SV_ANFDMS & SV_ANFGMS

    ACCT_NBR As Variant
    APPL_CODE As Variant
    BRANCH As Variant
    DATE_OPEN As Variant
    INFC_CUST_SHRT As String
    INST_NBR As Variant
    PRIM_OFFICER As String

    NotInTotal As Boolean

    End Type
    Type SQLserverTRNDataType 'SVX_ANFTRN_[date]

    ACCT_NBR As Variant
    APPL_CODE As Variant
    CHARGE As Variant
    INST_NBR As Variant
    NBR_ITEM As Variant
    SERVICE As Variant
    ReportColumnOrder As Variant

    NotInTotal As Boolean

    End Type
    Type SQLserverBILLDataType 'SVX_BILL_H_[date]

    ACCT_NBR As Variant
    APPL_CODE As Variant
    AVG_COL_BAL_AGGR As Variant
    AVG_LDG_BAL_AGGR As Variant
    CHARGE As Variant
    ChargeType As String
    COL_BAL_AGGR As Variant
    DirectCharge As Variant
    ECR_AMT As Variant
    ECR_APPLIED As Variant
    ECR_GIVEN As Variant
    INST_NBR As Variant
    LDG_BAL_AGGR As Variant
    PERIOD_DAYS As Variant
    WAIVE As Variant

    NotInTotal As Boolean
    End Type
    Type SQLserverSvcTotalType 'TOTALLING of SVX_ANFTRN_[date] by SERVICE

    CHARGE As Variant
    NBR_ITEM As Variant
    SVC_CODE As Variant

    End Type
    Type SQLserverDataType

    DatePeriod As String
    DatePeriodDescription As String

    'SUMMARY TAB
    SVX_BILL_H_TBLname As String 'SQL SERVER TABLE NAME with "date" appended to its name
    SVX_BILL_H_dda_to_ANFDMS_select_sql As String
    SVX_BILL_H_group_to_ANFGMS_select_sql As String
    SVX_BILL_H_dda_group_to_ANFDMS_ANFGMS As SQLserverBILLDataType

    'PxV, VOLUME TABs
    SVX_ANFTRN_TBLname As String 'SQL SERVER TABLE NAME with "date" appended to its name
    SVX_ANFTRN_dda_to_ANFDMS_select_sql As String
    SVX_ANFTRN_group_to_ANFGMS_select_sql As String
    SVX_ANFTRN_dda_group_to_ANFDMS_ANFGMS As SQLserverTRNDataType

    XLSFinalReportFileName As String

    End Type
    Public ADOCommand As ADODB.Command
    Public ADOConnection As ADODB.Connection
    'SUMMARY TAB
    Public ADOTableSqlserver_SVX_BILL_H_dda_group_to_ANFDMS_ANFGMS As ADODB.Recordset 'QUALIFIED INTERNATIONAL recordset with "date" appended to its name
    'PxV, VOLUME TABs
    Public ADOTableSqlserver_SVX_ANFTRN_dda_group_to_ANFDMS_ANFGMS As ADODB.Recordset 'QUALIFIED INTERNATIONAL recordset with "date" appended to its name
    Public ErrDateTime As String
    Public ErrDescription As String
    Public ErrNumber As Long
    Public ExcelApp As Excel.Application
    Public ExcelCellRange As String
    Public ExcelChart As Excel.Chart
    Public ExcelChartDataRange As String
    Public ExcelChartDataRangeNbrBegin As Long
    Public ExcelChartDataRangeNbrEnd As Long
    Public ExcelChartDate As String
    Public ExcelChartLabelRange As String
    Public ExcelWkbk As Excel.Workbook
    Public ExcelWksh As Excel.Worksheet
    Public ExcelXls As String
    Public ExcelXlsOpen As Boolean
    Public SQLserverReportDataARY() As SQLserverDataType
    Public SQLserverReportDataARYNbr As Long
    Public SQLserverReportDataARYNbrThis As Long
    Public Const TxtStrEMPTY As String = ""
    [/VBA]

  2. #2
    Knowledge Base Approver
    The King of Overkill!
    VBAX Master
    Joined
    Jul 2004
    Location
    Rochester, NY
    Posts
    1,727
    Location
    Hi Austen,

    I do want to again remind you that your .vbp file is not actually what you've posted above, the above is the code for your VbReport13MonthSummaryFORM.frm file, not the contents of your .vbp (the project file).

    When you open the vbp in VB, in the file menu do you have a "Make ____.exe" option?

  3. #3
    VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Oh I got it now. Except it wont compile. That is when I try to save the .exe the error is on the last line of the code. "Constants, fixed-length strings, arrays, user defined types and declare statements are not allowed as public members of object modules."

  4. #4
    VBAX Expert
    Joined
    Jul 2004
    Location
    Wilmington, DE
    Posts
    600
    Location
    Sounds like the code is in a form's module and not a regular module. Move it to a regular module, and try compiling as an exe again.
    Regards,

    Patrick

    I wept for myself because I had no PivotTable.

    Then I met a man who had no AutoFilter.

    Microsoft MVP for Excel, 2007 & 2008

  5. #5
    VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Thanks I will give it a go

  6. #6
    VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    OK I put the code in a module and it still will not compile. Now I get an error saying it cannot find the object or library on a line of code that is manipulating a text string with the MID function. It highlights MID with the error. BTW, I have a FORMS and a TYPES module. Does everything have to go in the regular module?

  7. #7
    VBAX Tutor
    Joined
    May 2004
    Location
    Germany, Dresden
    Posts
    217
    Location
    Please have a look at Project - References and see, whether there are any errors in the list, telling you that a required library could not be found. Usually I get this kind of error, because VB doesn't find some library and therefore stops loading the rest.

    Daniel

  8. #8
    VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    I checked that. If you click ok to the error message, the references box pop up and there is one that says missing but it is already checked. If you click help to the message, you get another message that says the MSDN is missing and to reinstall it.

  9. #9
    VBAX Tutor
    Joined
    May 2004
    Location
    Germany, Dresden
    Posts
    217
    Location
    Well, if it's checked and it says "missing" you might have to look, whether you need that reference in your code. If you don't need it, simply uncheck it and it should work.
    If your code needs that reference, you'll have to replace the missing one with a reference actually pointing to the needed .dll.

    Daniel

Posting Permissions

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