#1   Report Post  
Posted to microsoft.public.excel.misc
Bobak
 
Posts: n/a
Default Macro drive problem

I have written a macro that opens a number of workbooks from a network drive
using Excel. I would like this macro to be used by a number of users. However
users have the drive name on different letters eg on my computer A:\network
drive\file.xls but on colleagues it is B:\network drive\file.xls Can I get
the macro to be dynamic and point to the drive name rather than use the
letter as it returns an error unless the drive is on the same letter name as
I have written in the macro

Regards
  #2   Report Post  
Posted to microsoft.public.excel.misc
Stefi
 
Posts: n/a
Default Macro drive problem

If I were you I should st up a parameter sheet containing user names and
drive letters:

A B
Name Letter
user_1 X
user_2 Y
....
user_n Z

The macro should be informed of the actual user name (e.g. via an input box
in Workbook_open event procedure), then the filename to be opened can be
composed

filetoopen=VLOOKUP("user_n",A1:B5,2,FALSE)&":\"&ne twork_map_name&"\"&"file.xls"

Column B could contain Letter+network_map together if it is more suitable
for the case:

user_1 X:\network_map\


In this case composing the filename is simpler:

filetoopen=VLOOKUP("user_n",A1:B5,2,FALSE)&"file.x ls"

Regards,
Stefi

€˛Bobak€¯ ezt Ć*rta:

I have written a macro that opens a number of workbooks from a network drive
using Excel. I would like this macro to be used by a number of users. However
users have the drive name on different letters eg on my computer A:\network
drive\file.xls but on colleagues it is B:\network drive\file.xls Can I get
the macro to be dynamic and point to the drive name rather than use the
letter as it returns an error unless the drive is on the same letter name as
I have written in the macro

Regards

  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Macro drive problem

You can use the UNC Path in your open statement:

dim wkbk as workbook
set wkbk = workbooks.open(filename:="\\server\folder\folder\f ilename.xls")

....



Bobak wrote:

I have written a macro that opens a number of workbooks from a network drive
using Excel. I would like this macro to be used by a number of users. However
users have the drive name on different letters eg on my computer A:\network
drive\file.xls but on colleagues it is B:\network drive\file.xls Can I get
the macro to be dynamic and point to the drive name rather than use the
letter as it returns an error unless the drive is on the same letter name as
I have written in the macro

Regards


--

Dave Peterson
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
Macro problem Bonbon Excel Worksheet Functions 2 February 18th 06 08:07 PM
Macro problem....... Alec H Excel Discussion (Misc queries) 4 February 15th 06 11:38 AM
Multi-user macro on network drive? xangelusx Excel Discussion (Misc queries) 3 July 25th 05 10:05 PM
deleting a macro resulted in a problem militant Excel Discussion (Misc queries) 0 April 26th 05 05:21 AM
Problem executing a macro from different workbook where it is Sergio Calleja Excel Discussion (Misc queries) 1 January 17th 05 12:38 PM


All times are GMT +1. The time now is 04:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"