manoj.mcans
Registered User.
- Local time
- Today, 18:37
- Joined
- Sep 1, 2008
- Messages
- 18
Hi,
I am trying to open the excel file using VBA in MsAccess using below code, its execute fine and but didnot open the excel file
Can any one help me where i am missing , that would be great help.
---On Btn Click event------------
Private Sub Command0_Click()
Call ExcelInstance
End Sub
-----Check the excel file is runing or not------
Function IsExcelRunning() As Boolean
Dim xlApp As Excel.Application
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")
IsExcelRunning = (Err.Number = 0)
Set xlApp = Nothing
Err.Clear
End Function
------Opening the excel file-------------------------
Public Sub ExcelInstance()
Dim xlApp As Excel.Application
Dim ExcelRunning As Boolean
ExcelRunning = IsExcelRunning()
If ExcelRunning Then
Set xlApp = GetObject(, "Excel.Application")
Else
Set xlApp = CreateObject("Excel.Application")
End If
xlApp.Workbooks.Open "Path of File with folder name", True, False
If Not ExcelRunning Then xlApp.Quit
Set xlApp = Nothing
End Sub
I am trying to open the excel file using VBA in MsAccess using below code, its execute fine and but didnot open the excel file
Can any one help me where i am missing , that would be great help.
---On Btn Click event------------
Private Sub Command0_Click()
Call ExcelInstance
End Sub
-----Check the excel file is runing or not------
Function IsExcelRunning() As Boolean
Dim xlApp As Excel.Application
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application")
IsExcelRunning = (Err.Number = 0)
Set xlApp = Nothing
Err.Clear
End Function
------Opening the excel file-------------------------
Public Sub ExcelInstance()
Dim xlApp As Excel.Application
Dim ExcelRunning As Boolean
ExcelRunning = IsExcelRunning()
If ExcelRunning Then
Set xlApp = GetObject(, "Excel.Application")
Else
Set xlApp = CreateObject("Excel.Application")
End If
xlApp.Workbooks.Open "Path of File with folder name", True, False
If Not ExcelRunning Then xlApp.Quit
Set xlApp = Nothing
End Sub