Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dim dim is offline
external usenet poster
 
Posts: 123
Default How to validate path? --- bValidatePath ("") Then

Hi all,

I have two workbooks called Book1 and Book2. Book1 simply displays a
userform when opened, and when the user clicks 'Ok' it closes Book1 and opens
Book2.

I am going to create a 3rd workbook called Book3. Book3 will be an exact
copy of Book2, but in Book2 all VBA code path's read C:\.... and in Book3 I
will have them reading D:\...

This will be to allow a user to run the program from a hard-drive designated
as C or D. The files are all located in a folder called My Program, and the
user's install instructions are to copy the folder into their Program Files
path. So the total path on the users computer will end up being either:

C:\Program Files\My Program\Book2.xls
or
D:\Program Files\My Program\Book3.xls

When Book1 is open, I want to include in the Button1 Click macro some form
of validation so it can tell if it is located in C:\Program Files\... or
D:\Program Files\.... This will be followed by an IF THEN ELSE, so that if
its in C:\... Then it will open Book2, and if its in D:\... it will open
Book3....makes sense?...any ideas how to get this to work?

I think the code involves 'ValidatePath' something something?

Thankyou.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default How to validate path? --- bValidatePath ("") Then

You would not get an error. Dir(path) would simply return "" if the path
being sought were not available.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"dim" wrote in message
...
Hi,

GTV, I didn't try your way, because if the user has the files installed in
a
harddrive designated 'D', then I think your first If statement would
return
an error since there may be no C drive present at all. But thankyou.

Roger, I tried you way and thus far it's working, but I haven't
transferred
the files onto the other computer with the D drive to test it yet, but it
executes fine on my C drive with the code inserted for both.

Thankyou both for your help. Its appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.programming
dim dim is offline
external usenet poster
 
Posts: 123
Default How to validate path? --- bValidatePath ("") Then

My mistake, thanks for clarifying that.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default How to validate path? --- bValidatePath ("") Then

Actually, a better test than

If SomeString = ""

is

If Len(SomeString) = 0

Because it's quicker to determine the length of one string than to compare
the values of two strings.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"dim" wrote in message
...
My mistake, thanks for clarifying that.



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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
Validate Data in VBA "How to get lost focus cell address" HotRod Excel Programming 2 February 1st 05 08:02 PM


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