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

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Saving File w/o Overwrite? (VBA/Outlook 2002)

    Author
    Topic
    #358311

    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.

    Viewing 0 reply threads
    Author
    Replies
    • #534338

      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

      • #534356

        Thanks! thumbup

        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.

        • #534365

          You can have some fun with Format()

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

          format(now,”hmsms”) eargear

    Viewing 0 reply threads
    Reply To: Saving File w/o Overwrite? (VBA/Outlook 2002)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: