Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel and VB.net 2

Status
Not open for further replies.

DotNetBlocks

Programmer
Apr 29, 2004
161
US
Hello,

Is there a way to create an excel file on the fly, with macros dynamicly created based on criteria?

Thanks,

Babloome
 
Create a file yes.

Code:
Public Sub CreateExcel()
        Dim oExcel As Object
        Dim oBook As Object

        oExcel = CreateObject("Excel.Application")
        oBook = oExcel.Workbooks.Add

        'Macro code if possible

        oBook.SaveAs(WorkbookLocation & WorkbookName)
        oBook = Nothing
        oExcel.Quit()
        oExcel = Nothing
        GC.Collect()

About macros on the file I have no clue.

-I hate Microsoft!
-Forever and always forward.
 
For got to:

Code:
End Sub

at the end there.

-I hate Microsoft!
-Forever and always forward.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top