Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Opening a file command doesn't work

We have a VB program and runs from one file and tries to open another file
which is located in the same directory. The other file is called
"Updatefile.xls." THis macro runs fine at one computer that has Excel 2003,
but doesn't work on another computer that has Excel 2000. It will open on
the Excel 2000 computer if you provde the entire path.

Is this an Excel version problem or something else? If not, why does it run
on one computer (opening the 2nd file), but not on the other. If so, is
there a way to provide the path programmatically (we do not know where
various users of this program will put their files?)

Thanks for all your help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Opening a file command doesn't work

Hi,
try GetFile:
''' -------------------------------------------
Function GetFile() As String
Dim fd As Office.FileDialog
Dim action As Long

Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.AllowMultiSelect = False
.ButtonName = "Select file"
.Title = "Select Update file"
.Filters.Clear
.Filters.Add "Excel Files", "*.xls"
.InitialFileName = "Updatefile.xls"

action = .Show
If action = 0 Then ''' user cancelled
GetFile = ""
Else
GetFile = CStr(.SelectedItems(1))
End If
End With
End Function
'''------------------------------------------------
--
Regards,
Sébastien
<http://www.ondemandanalysis.com
<http://www.ready-reports.com


"Andyjim" wrote:

We have a VB program and runs from one file and tries to open another file
which is located in the same directory. The other file is called
"Updatefile.xls." THis macro runs fine at one computer that has Excel 2003,
but doesn't work on another computer that has Excel 2000. It will open on
the Excel 2000 computer if you provde the entire path.

Is this an Excel version problem or something else? If not, why does it run
on one computer (opening the 2nd file), but not on the other. If so, is
there a way to provide the path programmatically (we do not know where
various users of this program will put their files?)

Thanks for all your help

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
Opening Excel by double-clicking a file doesn't work! Dan Levin Excel Discussion (Misc queries) 4 April 1st 08 07:12 PM
Opening Excel 2003 file in Excel 2007: Links do not work Roshan Q Excel Discussion (Misc queries) 5 January 10th 08 10:24 PM
VBA - opening files with Shell command Eric[_32_] Excel Programming 3 October 29th 05 09:05 PM
Work Command Krandall Excel Discussion (Misc queries) 3 July 21st 05 12:12 PM
In addition to previous question, if opening an Excel file in NON-read-only mode, would the macros on the worksheets work as well? Greener Excel Programming 2 October 9th 03 03:40 AM


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