ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open files (https://www.excelbanter.com/excel-programming/333239-open-files.html)

Ernst Guckel[_4_]

Open files
 
Hey,

I have a spreadsheet that has a list of files in it that I test to see if
it is open and if not I open the file. Then on to the next one. The problem
is that I now need to add a database to the list.

I want to parse the list and if the file is a xls:
Open it if not already
& if a mdb open it if not already...

Is there a way to test if a mdb file is open from within excel? and how do
I open the file from within excel?

Ernst.


NickHK

Open files
 
Ernst,
By "mdb file is open", do you mean "Is any other user accessing the data " ?

The Excel concept of "Open" does not really apply to Access databases. What
are you trying to achieve ?

NickHK

"Ernst Guckel" wrote in message
...
Hey,

I have a spreadsheet that has a list of files in it that I test to see

if
it is open and if not I open the file. Then on to the next one. The

problem
is that I now need to add a database to the list.

I want to parse the list and if the file is a xls:
Open it if not already
& if a mdb open it if not already...

Is there a way to test if a mdb file is open from within excel? and how

do
I open the file from within excel?

Ernst.




Ernst Guckel[_4_]

Open files
 
All I'm trying to do is allow users to open all of their daily files in a
single click.

"NickHK" wrote:

Ernst,
By "mdb file is open", do you mean "Is any other user accessing the data " ?


No. The access GUI to open the file.

Ernst.


NickHK

Open files
 
Ernst,
How are you currently doing this with the Excel files ?

NickHK

"Ernst Guckel" wrote in message
...
Hey,

I have a spreadsheet that has a list of files in it that I test to see

if
it is open and if not I open the file. Then on to the next one. The

problem
is that I now need to add a database to the list.

I want to parse the list and if the file is a xls:
Open it if not already
& if a mdb open it if not already...

Is there a way to test if a mdb file is open from within excel? and how

do
I open the file from within excel?

Ernst.




Ernst Guckel[_4_]

Open files
 
Like this... Command button calls DailyFiles

Sub DailyFiles()
Application.StatusBar = False
'Get list of Daily Files and make sure that the're open
Dim List As Object
For Each List In Worksheets("Data Sheet").Range("DailyFiles")
IsOpen List.Value
Next
ThisWorkbook.Close
End Sub

Function IsOpen(wbname As String)

' Is Open Function

On Error Resume Next

Dim Active

Active = ActiveWorkbook.Name
If wbname = "" Then Exit Function
wbname = wbname & ".xls"
'Check to see if Workbook is Open
Dim wb As Workbook, wbs As Workbooks
For Each wb In Application.Workbooks
If wb.Name = wbname Then

'If Workbook is open Exit function
Exit Function

End If

Next wb
'Open Workbook
Workbooks.Open Filename:=ActiveWorkbook.Path & "\" & wbname
ActiveWorkbook.RunAutoMacros xlAutoOpen
'Activate calling workbook
Windows(Active).Activate
End Function


"NickHK" wrote:

Ernst,
How are you currently doing this with the Excel files ?

NickHK

"Ernst Guckel" wrote in message
...
Hey,

I have a spreadsheet that has a list of files in it that I test to see

if
it is open and if not I open the file. Then on to the next one. The

problem
is that I now need to add a database to the list.

I want to parse the list and if the file is a xls:
Open it if not already
& if a mdb open it if not already...

Is there a way to test if a mdb file is open from within excel? and how

do
I open the file from within excel?

Ernst.






All times are GMT +1. The time now is 12:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com