PDA

View Full Version : Convert a .vbp to .exe program



austenr
10-13-2006, 07:34 AM
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.

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 = ""

mvidas
10-13-2006, 08:05 AM
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?

austenr
10-13-2006, 10:30 AM
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."

matthewspatrick
10-13-2006, 03:05 PM
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.

austenr
10-13-2006, 03:14 PM
Thanks I will give it a go

austenr
10-16-2006, 05:51 AM
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?

Steiner
10-16-2006, 11:02 PM
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

austenr
10-17-2006, 12:54 PM
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.

Steiner
10-18-2006, 01:28 AM
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