LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default find if there is a particular folder in a path

hello there,


i have to check whether a user has saved a particular workbook with the
..htm or .html extension. that is the easy bit.

the user has to save the workbook in a folder on the desktop.

i take the workbook's fullname (see sub below) and check to see if the
last 4 or 5 characters are .htm or .html respectively

please bear in mind that we are not intrested in the name of the
workbook. we just want him to give a name in the workbook and save it
as .htm or .html. see an example below.


C:\Documents and Settings\nkantzelis\Desktop\test\*****.htm

that is the first bit.


now i want to check that if he saved it in the particular folder named
"test".

that is not a problem you might think. just take the 35 or so
characters from the left of the full name and see if test is included.


there is a problem though.



every user is going to log on on a different machine and have a
different user name


so the path will be like this


C:\Documents and Settings\********\Desktop\test\*****.htm


i can take the string using

workbookname= Application.Workbooks(1).fullname


so now workbookname contains something like this


C:\Documents and Settings\********\Desktop\test\*****.htm



is there any way that i can check that in this string there is a "test"
substring?

how can i do it using the Like operator?

that is mi question.





thanks a lot

-----------------------------------------------------------

Sub checkfilenameextension()


'On Error Resume Next

Set app = Application.Workbooks(1)

FullName = app.FullName

MsgBox FullName

MsgBox Right(FullName, 33)


If Right(FullName, 4) < ".htm" _
And Right(FullName, 5) < ".html" Then
ECDLANSWER = 2
MsgBox ("error")
Exit Sub
End If


MsgBox ("ok")

End Sub



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

 
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
Contatenate folder path strings, how ? Excel-Guy Excel Worksheet Functions 2 January 19th 10 12:05 PM
Relative Path to a Folder Heliocracy Excel Discussion (Misc queries) 3 October 3rd 07 04:28 PM
Setting a path to a folder Boots Excel Discussion (Misc queries) 2 August 10th 06 02:14 PM
Browse button on form for folder path Greshter Excel Discussion (Misc queries) 2 January 12th 06 10:20 PM
how to change path name of html source folder ? naruemol Excel Worksheet Functions 0 June 17th 05 03:50 AM


All times are GMT +1. The time now is 04:42 AM.

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"