Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 788
Default Macro To Open a User selected File

I need a macro that allows the user to select the file. I have figured out to
write a macro for specific path however, as this workbook will go to many
differnt users that will have differnt names and paths for the file. Any help
would be awsome. Thank in advance.

-CM
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,123
Default Macro To Open a User selected File

One way

There is no code to test if the workbook is open in this example

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
Workbooks.Open (FName)
End If

ChDrive SaveDriveDir
ChDir SaveDriveDir

End Sub


--

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


"Chris" wrote in message ...
I need a macro that allows the user to select the file. I have figured out to
write a macro for specific path however, as this workbook will go to many
differnt users that will have differnt names and paths for the file. Any help
would be awsome. Thank in advance.

-CM

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 788
Default Macro To Open a User selected File

Your A PRO!

"Ron de Bruin" wrote:

One way

There is no code to test if the workbook is open in this example

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
Workbooks.Open (FName)
End If

ChDrive SaveDriveDir
ChDir SaveDriveDir

End Sub


--

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


"Chris" wrote in message ...
I need a macro that allows the user to select the file. I have figured out to
write a macro for specific path however, as this workbook will go to many
differnt users that will have differnt names and paths for the file. Any help
would be awsome. Thank in advance.

-CM


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
How can second, third user sign excel file containing macro Sevgi Excel Discussion (Misc queries) 0 November 10th 06 03:23 PM
Macro stop if file in use by other user? Bry Excel Discussion (Misc queries) 5 August 11th 06 04:27 PM
File is already open by user X eagle13 Excel Discussion (Misc queries) 1 July 24th 06 01:14 PM
Macro to Sort automatically when file/save is selected KDG Excel Discussion (Misc queries) 3 December 20th 05 08:28 PM
not being prompted that user has file open maryj Excel Discussion (Misc queries) 0 December 15th 05 03:10 PM


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