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

Shorten file name



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old November 4th 09, 10:29 PM posted to microsoft.public.outlook.program_vba
hlock
external usenet poster
 
Posts: 23
Default Shorten file name

I have vba in Outlook 2007 that saves each attachment on an email and imports
it to our document repository system. However, I need to remove spaces in
the file name because if the file path string with embedded spaces is passed
to the import program, it thinks each space delimits a new file name. I need
to get the 8.3 format of the file path string. Here is what I have currently:

For Each objMsg In objSelection
' This code only strips attachments from mail items.
If objMsg.Class = olMail Then
' Get the Attachments collection of the item.
Set objAttachments = objMsg.Attachments
lngCount = objAttachments.Count
If lngCount 0 Then
' We need to use a count down loop for
' removing items from a collection. Otherwise,
' the loop counter gets confused and only every
' other item is removed.
For i = lngCount To 1 Step -1
' Save attachment before deleting from item.
' Get the file name.
strfile = objAttachments.Item(i).FileName
' Combine with the path to the Temp folder.
strfile = strFolder & strfile
' Save the attachment as a file.
objAttachments.Item(i).SaveAsFile strfile
' Delete the attachment.
'objAttachments.Item(i).Delete

ExecCmd "ttimport.exe " & app & " " & strfile
Next i
End If
objMsg.Save
End If
Next

I know that I need to put something in here to shorten the file name, but
I'm not sure where and how. Any help is appreciated. Thanks!
 




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
Import XP .pst file to Outlook 2003 .pst error = File access d EZ2LUVME Outlook - Installation 1 June 1st 08 11:51 AM
trying to export .aba file from Palm Desktop to .csv file and havingproblems with irregular characters Joe Outlook - General Queries 1 May 4th 08 04:18 PM
PRF file problem wiht personal folders data file password protecte Groupex1 Outlook - Installation 0 November 1st 07 08:01 PM
Outlook file translators stuck on a default data file or not worki Charles griffiths Outlook - Using Contacts 2 April 23rd 07 11:50 AM
excel file type missing from import a file window in outlook xanadufl Outlook - Using Contacts 9 February 28th 06 09:55 AM


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