View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
frice frice is offline
external usenet poster
 
Posts: 6
Default xlDialogOpen arguments

Correction: The xlDialogOpen example showing arg3:=True appears in Excel 2007
help at: http://msdn2.microsoft.com/en-us/library/bb236937.aspx

"Jim Rech" wrote:

so I'm assuming the Arg3:=True should automatically open the file as
read-only


The Args are used to preset dialog options, where they exist. The 'read
only' option check box has not existed since Excel 95.

You're going to have to switch to this to do what you want:

Dim FName As Variant
FName = Application.GetOpenFilename("Excel Files (*.xl*),*.xl*")
If FName < False Then
Workbooks.Open Filename:=FName, ReadOnly:=True
End If

--
Jim
"frice" wrote in message
...
| Thanks for the reponse Sebastien. In my app, I need to use xlDialogs. The
| list of arguments shows the third argument as "read_only" so I'm assuming
the
| Arg3:=True should automatically open the file as read-only but setting the
| argument to true has no effect. Any other ideas? Thanks
|
| "sebastienm" wrote:
|
|
| xlDialogOpen
| ---------------
| file_text, update_links, read_only, format, prot_pwd, write_res_pwd,
| ignore_rorec, file_origin, custom_delimit, add_logical, editable,
| file_access, notify_logical, converter
|
| More generally: for all dialogs
| -----------------------------------
| type Application.Dialogs, then select 'Dialogs' and press F1 to get the
| Help. There, click the 'Dialogs' link and finally on that page you have
a
| "see Built-in Dialog Box Argument Lists." link for all Dialogs.
|
| Option.
| ---------
| You can use the other dialog to open files. I personally prefer it:
| Application.FileDialog(msoFileDialogOpen)
| Check the help for more details.
|
| --
| Regards,
| Sébastien
| <http://www.ondemandanalysis.com
|
|
| "frice" wrote:
|
| I am trying to display the file Open dialog such that when the user
selects
| the particular file, it is automatically opened as Read-Only. I'm
using:
|
| Application.Dialogs.Item(xlDialogOpen).Show Arg1:="Book1.xlsm",
Arg3:=True
|
| Arg1 works so that only Book1.xlsm is shown but when I open the file,
it is
| not opened as read-only. Any ideas of what I'm doing wrong?
|
| Thanks