Problem opening excel with VB6 EXE program

white6174

Board Regular
Joined
May 6, 2002
Messages
137
Heres the problem,

I have a VB6 Program that I'm using to open an excel file then run a macro.

Code:
Private Sub btnOPEN_Click()
    Dim xl As Object
    
    Set xl = CreateObject("Excel.Application")
    
    'xl.Visible = True
    frmMain.Visible = False
    xl.workbooks.Open "\\termsrv-2\SE\BUILDERS\TEMP\PRJ\DATA\ss template.xls", False, True
    xl.workbooks("ss Template.xls").Worksheets("Data SS").Range("LOTID") = ACCPACID
    xl.workbooks("ss Template.xls").Worksheets("Data SS").Range("COMMUNITY_ID") = COMMID
    xl.workbooks("ss Template.xls").Worksheets("Data SS").Range("rngUNIQID") = 0
    xl.workbooks("ss Template.xls").Worksheets("Data SS").Range("rngREVISION") = REVISION
    xl.Run "Main_Code"
    
    frmMain.Visible = True
    
End Sub


The program runs fine if the excel file is not compiled (I EXPORT OUT ALL THE VBA THEN RE-IMPORT IT)

when compile I get a Run-Time '-2147417851 (80010105) Method '~' of object '~' failed

Also I have noticed that the file
uncompiled is 404k
compiled is 736k

any ideas

running windows XP Pro
excel 2003

thanks for any input you can provide
steve
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

nbrcrunch

Well-known Member
Joined
Jan 1, 2003
Messages
2,062
I'm not sure if I understand yo completely, but VBA does not compile code.
 

white6174

Board Regular
Joined
May 6, 2002
Messages
137
sure it does,
but it doesn't compile for the purpose of making an EXE
the main purpose for compiling the VBAProject is for error checking and I believe it helps with performance.


in the Visual Basic Editor
goto debug / Compile VBAProject

thanks steve
 

Watch MrExcel Video

Forum statistics

Threads
1,118,290
Messages
5,571,327
Members
412,382
Latest member
Langtn02
Top