A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Seperating Extension and File Name



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5  
Old March 17th 08, 06:55 PM posted to microsoft.public.outlook.program_vba
Rob
external usenet poster
 
Posts: 146
Default Seperating Extension and File Name

Sweet! Thank You Both!


"Sue Mosher [MVP-Outlook]" wrote:

The InStrRev() function will find the first period, searching from the end of the string:

strAtmtName = Atmt.FileName
intLoc = InStrRev(strAtmtName, ".")
If intLoc 0 Then
fName = Left(strAtmtName , intLoc - 1)
fExt = Mid(strAtmtName , intLoc + 1)
Else
fName = strAtmtName
fExt = ""
End If

I'd suggest that you read up on the InStrRev, Left and Mid functions in Help, now that you've seen them in action.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Rob" wrote in message ...
I was told I should use this section for my request for help so here I go
again.

I am trying to seperate the extension from a file name so that what I am
left with is an extension and a file name that's stored in String Variables
for re-use later on in the macro. I have no clue how to really do this but
what I have gotten so far is below and apparently that's not all that right
either. Can someone please show me the right way of doing this so I can have
it to refer to in the future, because I can't seem to find it with the help
files of Outlook?

Dim Item As Object
Dim Atmt As Attachment
Dim fExt As String
Dim fName As String

For Each Atmt In Item.Attachments
fExt = Right(Atmt.FileName, 4) 'returns the .??? extension
fName =

For the fName above I tried to do a Trim/RTrim & LTrim but all I get in the
help keeps referring to (Expression) with no clue as to what expression is
the correct expression. Also Apparently there is a possibility of there being
more than three letters and a dot for the extension so now I have to look at
using "InstrRev" to find the dot and then figure out the right side verses
the left side. What if there's more than one dot in the name of the file,
wouldn't that throw it all off??? I have NO idea what to do with that at all.
When I do the F1 deal in the macro editor, well I'm lost at that too.


Thank You Very Much for Your Time and Help.
Rob


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
XFD file extension Tommy Boy[_2_] Outlook - Calandaring 4 December 21st 07 09:37 PM
file extension types smithassoc Outlook Express 2 October 13th 07 12:55 AM
Nasty looking file extension Tracey Outlook - General Queries 1 May 17th 07 01:18 PM
hide file extension Xavier Outlook - General Queries 5 March 8th 07 08:30 PM
Sent Attachment Without File Extension Gerald Boutin Outlook - General Queries 2 March 2nd 06 04:34 PM


All times are GMT +1. The time now is 03:40 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.