Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Jul 2001
    Location
    Agoura Hills, California, USA
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Saving File w/o Overwrite? (VBA/Outlook 2002)

    Just putting the finishing touches on my saga to quasi-automate the Tech Support emails here without using Exchange. The last little kink would appear to be saving the answered message to a network folder. The code below works:

    Public Sub ToQA()
    Dim myFinishedReply As MailItem
    Set myFinishedReply = ActiveInspector.CurrentItem


    myFinishedReply.SaveAs "N:JebSupport" & myFinishedReply.To & ".msg", olMSG

    MsgBox "Reply Saved! You can close this email without saving."

    Set myFinishedReply = Nothing

    End Sub

    The only problem is that the folder can only have one support email from any particular email address. The next one that comes in as jeb@example.com overwrites the previous one with that name.

    I've been trying to use a Time value as the MSG's name, but I get nasty runtime errors when I try this. Here's what I've kludged in to attempt this...

    Dim strTime As String
    strTime = Time
    myFinishedReply.SaveAs "N:JebSupport" & strTime & ".msg", olMSG

    Are the colons screwing it up? Is the fact that Time() returns a Variant that I'm compelling to be a String hurting me?

    Debug.Print shows the time as hh:mm:ss XM format.

    Is there some better way to accomplish the same thing? Any pointers will be much appreciated.

  2. #2
    Lounger
    Join Date
    Feb 2001
    Location
    London UK, Gtr London, England
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Saving File w/o Overwrite? (VBA/Outlook 2002)

    You can't have ":" in a file name, which you get if you use "time"
    You could use the messages Entry ID as a varible, which it gets when you send it.
    Or put the email into a public folder, which was part of a Outlook Forms Helpdesk system I created from the example application Microsoft have.

    Hope this helps

  3. #3
    Lounger
    Join Date
    Jul 2001
    Location
    Agoura Hills, California, USA
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Saving File w/o Overwrite? (VBA/Outlook 2002)

    Thanks! <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

    We don't have Exchange, so the public folder business isn't doable quite yet, but that EntryID worked just fine. Nice and unique. That's the trick! If anyone DOES figure out a way to get the time without colons, that too would be appreciated.

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Saving File w/o Overwrite? (VBA/Outlook 2002)

    You can have some fun with Format()

    Get the hour,minutes, seconds and millseconds all bunched up:

    format(now,"hmsms") <img src=/S/eargear.gif border=0 alt=eargear width=20 height=20>
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •