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
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,057
Messages
5,835,162
Members
430,343
Latest member
t0m_c

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top