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

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
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
 
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,218
Members
448,554
Latest member
Gleisner2

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
Back
Top