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 xl2k vs xl03 code difference

Hi All.......the following code works fine in xl03 but does not work in xl2k.
Can anyone please tell me if it can be modified to work in xl2k?

Dim strFile As Variant
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.Filters.Add "Excel Files", "*.xls"
.InitialFileName = ThisWorkbook.Path & "\"
.Show
strFile = .SelectedItems(1)
End With

Workbooks.Open Filename:=strFile

TIA
Vaya con Dios,
Chuck, CABGx3

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default xl2k vs xl03 code difference

Hi Clr,

Hi All.......the following code works fine in xl03 but does not work in xl2k.
Can anyone please tell me if it can be modified to work in xl2k?


I think the FileDialog thingy was introduced with Excel XP.

You can use something like this on any Excel version as of '97:

Sub GetOpenFileNameExample()
Dim lCount As Long
Dim vFilename As Variant
Dim sPath As String
Dim lFilecount As Long
sPath = "c:\windows\temp\"
ChDrive sPath
ChDir sPath
vFilename = Application.GetOpenFilename( _
"Microsoft Excel files (*.xls),*.xls", , _
"Please select the file(s) to open", , False)
If TypeName(vFilename) = "Boolean" Then Exit Sub
Workbooks.Open cstr(vFilename)
End Sub

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
Member of:
Professional Office Developer Association
www.proofficedev.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default xl2k vs xl03 code difference

Thanks Jan Karel, I appreciate that very much.
I'll give it a try ASAP.

Vaya con Dios,
Chuck, CABGx3

"Jan Karel Pieterse" wrote:

Hi Clr,

Hi All.......the following code works fine in xl03 but does not work in xl2k.
Can anyone please tell me if it can be modified to work in xl2k?


I think the FileDialog thingy was introduced with Excel XP.

You can use something like this on any Excel version as of '97:

Sub GetOpenFileNameExample()
Dim lCount As Long
Dim vFilename As Variant
Dim sPath As String
Dim lFilecount As Long
sPath = "c:\windows\temp\"
ChDrive sPath
ChDir sPath
vFilename = Application.GetOpenFilename( _
"Microsoft Excel files (*.xls),*.xls", , _
"Please select the file(s) to open", , False)
If TypeName(vFilename) = "Boolean" Then Exit Sub
Workbooks.Open cstr(vFilename)
End Sub

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
Member of:
Professional Office Developer Association
www.proofficedev.com

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default xl2k vs xl03 code difference

Outstanding........works super-fine for me

Many thanks Jan Karel

Vaya con Dios,
Chuck, CABGx3



"Jan Karel Pieterse" wrote:

Hi Clr,

Hi All.......the following code works fine in xl03 but does not work in xl2k.
Can anyone please tell me if it can be modified to work in xl2k?


I think the FileDialog thingy was introduced with Excel XP.

You can use something like this on any Excel version as of '97:

Sub GetOpenFileNameExample()
Dim lCount As Long
Dim vFilename As Variant
Dim sPath As String
Dim lFilecount As Long
sPath = "c:\windows\temp\"
ChDrive sPath
ChDir sPath
vFilename = Application.GetOpenFilename( _
"Microsoft Excel files (*.xls),*.xls", , _
"Please select the file(s) to open", , False)
If TypeName(vFilename) = "Boolean" Then Exit Sub
Workbooks.Open cstr(vFilename)
End Sub

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
Member of:
Professional Office Developer Association
www.proofficedev.com

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default xl2k vs xl03 code difference

Hi Clr,

Many thanks Jan Karel


You're welcome.

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
Member of:
Professional Office Developer Association
www.proofficedev.com

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
XL03 - Cell Text value not saved Robin Excel Programming 3 September 13th 07 06:00 AM
Sub to extract uniques from 200k data in xl03 Max Excel Programming 28 August 6th 07 02:53 AM
IF function in Data Validation- XL03 Conker10382 Excel Discussion (Misc queries) 1 June 26th 07 12:37 AM
How do I auto-alphabatize in XL03? Conker10382 Excel Discussion (Misc queries) 1 June 5th 07 12:18 AM
Help! Bug-esque code behaivor on Windows 2K Server & XL2K Mike Mertes Excel Programming 1 November 10th 04 11:47 PM


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