[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Renaming Outlook CSV Detachments

Posted on 2011-09-28
7
Medium Priority
?
262 Views
Last Modified: 2013-02-15
Hello Experts.  I am a newbie and trying to resolve this issue:

I am trying to create a file name for csv attachments that I am saving on the network.  

The format that I want to save the files is:

ReceivedTime less 1 day, formatted ddmmyyyy plus the file name

example:

file ABCDEF.CSV arrived today,  28 September, so the file saved with yesterdays date:

H:\\FOLDER1\FOLDER2\27092011 ABCDEF.CSV

Whilst I can get the file to detach and save, I am struggling to get the file name  correct file name.

I will be very grateful your help.


0
Comment
Question by:MagicMoggy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
7 Comments
 
LVL 65

Expert Comment

by:RobSampson
ID: 36730966
Hi, I think you'll be after something like this.

Regards,

Rob.
strFolder = "H:\FOLDER1\FOLDER2\"
If Right(strFolder, 1) <> "\" Then strFolder = strFolder & "\"

'....attach to your inbox and then go through the messages

For Each Item In Inbox.Items
	strTimeReceived = objMessage.TimeReceived
	dteYesterday = DateAdd("d", -1, CDate(strTimeReceived))
	strDate = Right("0" & Day(dteYesterday), 2) & Right("0" & Month(dteYesterday), 2) & Year(dteYesterday)
	For Each Atmt In Item.Attachments
		strFilePath = strFolder & strDate & " " & Atmt.FileName
		Atmt.SaveAsFile strFilePath
	Next
Next

Open in new window

0
 

Accepted Solution

by:
MagicMoggy earned 0 total points
ID: 36815789
Ron, thank you for your speedy reply.  I did have trouble with line 8, and after much time I realised that the solution was to simply knock off the value of 1 from the RecceivedTime, ensuring that the ((olkMessage.ReceivedTime - 1) was entered in brackets, (otherwise it did not deduct the value of 1).

'olkmessage as outlook mailitem,
              strDate = Strings.Format((olkMessage.ReceivedTime - 1), "ddmmyyyy") & " "
               strFilename = strDate & strFilename
               olkAttachment.SaveAsFile strRootFolderPath & strFilename

Again many thanks for your help.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 36818568
>> Strings.Format

Does that means your code is .NET?

Anyway, is that solved then, or is there something else you need?

Regards,

Rob.
0
 

Author Comment

by:MagicMoggy
ID: 36890271
I am a complete novice, but I believe it is VBA!!

Regards
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 36890982
OK.  I haven't seen that notation be able to be used in VBA, but if it works for you, then great!

I see you're new to EE.  Welcome!

Now if you have found your solution, you can select the comments that attributed to the answer, in order to close the question.

Thanks,

Rob.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question