Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Select a file to open

Hi All.......

The following code works fine in XL2007, but I am working in XL2000 and it
won't run there. Does anyone know how I can achive the same thing in XL2000,
please?

Dim strFile As Variant
On Error GoTo 200
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.Filters.Add "Excel Files", "*.xl*"
.InitialFileName = ThisWorkbook.Path & "\"
.Show
strFile = .SelectedItems(1)
End With
Application.DisplayAlerts = False
Application.EnableEvents = False
Workbooks.Open Filename:=strFile

TIA
Vaya con Dios,
Chuck, CABGx3


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Select a file to open

Hi Chuck,

These display the File Open dialog and then open the file selected.
Works in XL97

'Built-in path...
Application.Dialogs(xlDialogOpen).Show Application.LibraryPath
'Already there...
Application.Dialogs(xlDialogOpen).Show ThisWorkbook.Path
'Specific path...
Application.Dialogs(xlDialogOpen).Show "C:\Documents and Settings\CLR\My Documents\Excel Files"
--
Regards,
Jim Cone
Portland, Oregon USA



"CLR"
wrote in message ...
Hi All.......

The following code works fine in XL2007, but I am working in XL2000 and it
won't run there. Does anyone know how I can achive the same thing in XL2000,
please?

Dim strFile As Variant
On Error GoTo 200
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.Filters.Add "Excel Files", "*.xl*"
.InitialFileName = ThisWorkbook.Path & "\"
.Show
strFile = .SelectedItems(1)
End With
Application.DisplayAlerts = False
Application.EnableEvents = False
Workbooks.Open Filename:=strFile

TIA
Vaya con Dios,
Chuck, CABGx3


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Select a file to open

xl2003 example of one I did for a client recently. Opens the folder and lets
you select the file to use

Sub SAS_OpenFileToCheck()
Fn = Application.GetOpenFilename(FileFilter:= _
"Excel Files (*.xls), *.xls", Title:="Please select a file")
If Fn = False Then
MsgBox "Please start over and select a file", Title:=" SalesAid
Software"
Exit Sub
Else
Workbooks.Open Filename:=Fn
'MsgBox Fn

'Call SAS_ColorCellsFromCodeFile

MsgBox " All Done Be sure to SAVE file ", Title:=" SalesAid Software"

End If
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"CLR" wrote in message
...
Hi All.......

The following code works fine in XL2007, but I am working in XL2000 and it
won't run there. Does anyone know how I can achive the same thing in
XL2000,
please?

Dim strFile As Variant
On Error GoTo 200
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.Filters.Add "Excel Files", "*.xl*"
.InitialFileName = ThisWorkbook.Path & "\"
.Show
strFile = .SelectedItems(1)
End With
Application.DisplayAlerts = False
Application.EnableEvents = False
Workbooks.Open Filename:=strFile

TIA
Vaya con Dios,
Chuck, CABGx3



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
Select File to Open CrimsonPlague29 Excel Programming 1 June 12th 08 02:29 AM
"Open Browser Window And Select A File" Don Excel Programming 13 February 26th 08 06:55 PM
select open webpage, copy information to open worksheet Kevin Excel Programming 2 September 5th 06 05:10 AM
When I select "Open" from the "File" menu in Excel, I get only a . dan Excel Discussion (Misc queries) 1 November 30th 04 11:25 PM
open file dialog-select file-import worksheet Divinedar Excel Programming 1 January 16th 04 07:13 PM


All times are GMT +1. The time now is 11:25 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"