Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default Workbooks.Open using Dialog box

Is there a way to open a file as ReadOnly using
Application.Dialog(xlDialogOpen).Show?

I want to write re-usable code to allow another end-user to open an Excel
workbook as ReadOnly without first requiring someone else on the network
first having it open.

I would use Workbooks.Open myPath & myFile & "xls" but I don't know what
file the end user will want to open.

Any help will be appreciated.

Thanks,

Sam
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Workbooks.Open using Dialog box

Try GetOpenFilename

Sub test()
Dim FName As Variant
Dim wb As Workbook
Dim MyPath As String
Dim SaveDriveDir As String

SaveDriveDir = CurDir

MyPath = ThisWorkbook.Path
ChDrive MyPath
ChDir MyPath

FName = Application.GetOpenFilename(filefilter:="Excel Files (*.xls), *.xls")
If FName < False Then
Set wb = Workbooks.Open(FName, ReadOnly:=True)
End If

ChDrive SaveDriveDir
ChDir SaveDriveDir

End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Sam" wrote in message ...
Is there a way to open a file as ReadOnly using
Application.Dialog(xlDialogOpen).Show?

I want to write re-usable code to allow another end-user to open an Excel
workbook as ReadOnly without first requiring someone else on the network
first having it open.

I would use Workbooks.Open myPath & myFile & "xls" but I don't know what
file the end user will want to open.

Any help will be appreciated.

Thanks,

Sam

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
Open Dialog Box to return Selected File Path and Not Open it. DMS Excel Programming 4 January 26th 10 12:46 PM
Opening/Closing workbooks without dialog boxes Steve :) Excel Programming 2 September 20th 05 09:37 PM
control of dialog macro dialog box. on open Gerry Abbott Excel Programming 0 July 22nd 04 05:41 PM
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed Frank Jones Excel Programming 2 June 15th 04 03:21 AM
Dialog Box List of Current Open Workbooks Frank & Pam Hayes Excel Programming 2 January 25th 04 02:28 PM


All times are GMT +1. The time now is 01:43 AM.

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"