Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default File open on Erro question

I am using the following code to open a read only, non-visible spreadsheet. I
would like to be able to pop a dialog box/File search window if an error
occurs. This way the user can search for the file if it has been moved. What
do I need to add/call to make this happen?

'============================ Open LE Read Only and Invisible
=====================
On Error Resume Next
'Range("b3") = MyPath & LE_Actuals & Arr(i)
If Dir(MyPath & LE_Actuals & "\" & Arr(i)) < "" Then
Workbooks.Open (MyPath & LE_Actuals & Arr(i)), 0, ReadOnly:=True
ActiveWorkbook.Windows(1).Visible = False
End If
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default File open on Erro question

sStr = MyPath & LE_Actuals & "\" & Arr(i)
If Dir(sStr) < "" Then
Workbooks.Open (sStr,0, ReadOnly:=True)
ActiveWorkbook.Windows(1).Visible = False
Else
msgbox sStr & " was not found" & vbCrLf & _
"Please select the file to open after clicking OK"
d1 = curdir
chdrive MyPath
chdir MyPath & LE_Actuals
fName = Application.GetOpenFileName("Excel Files (*.xls),*.xls")
if fName < False then
ActiveWorkbook.Open(fName,0,ReadOnly:=True)
ActiveWorkbook.Windows(1).Visible = False
chdrive d1
chdir d1
else
chdrive d1
chdir d1
Exit Sub
end if
End If

Although it seems odd to prompt the user to designate a file and then open
it hidden.

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
...
I am using the following code to open a read only, non-visible

spreadsheet. I
would like to be able to pop a dialog box/File search window if an error
occurs. This way the user can search for the file if it has been moved.

What
do I need to add/call to make this happen?

'============================ Open LE Read Only and Invisible
=====================
On Error Resume Next
'Range("b3") = MyPath & LE_Actuals & Arr(i)
If Dir(MyPath & LE_Actuals & "\" & Arr(i)) < "" Then
Workbooks.Open (MyPath & LE_Actuals & Arr(i)), 0, ReadOnly:=True
ActiveWorkbook.Windows(1).Visible = False
End If



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default File open on Erro question

Tom We open the file so that we can perfrom a series of changes to it,
extract data and then close it down without any intervention from the users
who if they could, would certainly take the oportunity to change the data in
their favour.

Thanks for the help I will try out the code today!

"Tom Ogilvy" wrote:

sStr = MyPath & LE_Actuals & "\" & Arr(i)
If Dir(sStr) < "" Then
Workbooks.Open (sStr,0, ReadOnly:=True)
ActiveWorkbook.Windows(1).Visible = False
Else
msgbox sStr & " was not found" & vbCrLf & _
"Please select the file to open after clicking OK"
d1 = curdir
chdrive MyPath
chdir MyPath & LE_Actuals
fName = Application.GetOpenFileName("Excel Files (*.xls),*.xls")
if fName < False then
ActiveWorkbook.Open(fName,0,ReadOnly:=True)
ActiveWorkbook.Windows(1).Visible = False
chdrive d1
chdir d1
else
chdrive d1
chdir d1
Exit Sub
end if
End If

Although it seems odd to prompt the user to designate a file and then open
it hidden.

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
...
I am using the following code to open a read only, non-visible

spreadsheet. I
would like to be able to pop a dialog box/File search window if an error
occurs. This way the user can search for the file if it has been moved.

What
do I need to add/call to make this happen?

'============================ Open LE Read Only and Invisible
=====================
On Error Resume Next
'Range("b3") = MyPath & LE_Actuals & Arr(i)
If Dir(MyPath & LE_Actuals & "\" & Arr(i)) < "" Then
Workbooks.Open (MyPath & LE_Actuals & Arr(i)), 0, ReadOnly:=True
ActiveWorkbook.Windows(1).Visible = False
End If




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sumproduct Erro AussieBec Excel Discussion (Misc queries) 2 April 4th 10 10:45 AM
Macro erro orquidea Excel Discussion (Misc queries) 7 December 16th 07 07:23 PM
In Excel - Use Windows Explorer instead of File Open to open file KymY Excel Discussion (Misc queries) 1 August 5th 06 09:59 PM
format question when open csv file Jeff Excel Discussion (Misc queries) 1 December 1st 04 06:53 PM
WORKBOOKS.OPEN (URL) - How to trap a connection-lost/ timeout erro BHARATH RAJAMANI Excel Programming 3 September 18th 04 02:37 PM


All times are GMT +1. The time now is 04:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"