[RESOLVED] Help in calling EXCEL application in VB
hi.
i am able to create an excel document using my program by using this code:
Dim xlObject As Object
Dim xlWB As Workbook
Dim xlSheet As Worksheet
Application.DisplayAlerts = False
Set xlObject = GetObject("", "Excel.Application")
Set xlWB = xlObject.Workbooks.Add
Set xlSheet = xlObject.Application.ActiveWorkbook.Sheets(1)
xlObject.Visible = True
With xlSheet
.Name = "Test"
End With
-- what if i want to call an existing excel document. i tried this code but it unloads on its on.
Dim xlObject As Object
Application.DisplayAlerts = False
Set xlObject = GetObject("C:\Test.xls", "Excel.Template")
Application.Visible = True
--- i want to show the template and edit it... thanks...
Re: Help in calling EXCEL application in VB
To open an existing workbook.
VB Code:
Option Explicit
'Add a reference to MS Excel xx.0 Object Library
Private Sub Form_Load()
Dim xlObject As Excel.Application
Dim xlWB As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Application.DisplayAlerts = False
Set xlObject = Excel.Application
Set xlWB = xlObject.Workbooks.Open("C:\Test.xls")
Set xlSheet = xlWB.Sheets(1)
xlObject.Visible = True
With xlSheet
.Name = "Test"
End With
End Sub
Re: Help in calling EXCEL application in VB
thank you so much Mr.RobDog888
that really helped
thanks again sir.! have nice day