+ Reply to Thread
Results 1 to 3 of 3

Excel VBA Open Outlook Template as a template for editing

  1. #1
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    579

    Excel VBA Open Outlook Template as a template for editing

    I don't know if this is possible, but I want the user to be able to open a template selected from a menu and
    • The template remain as a template
    • When the user clicks "Save" the template is either
    • Saved to the same location it was called from, or at the user's discretion
    • Saved as a new template under a new name.


    Creating the menu system is not the problem here; it is having Outlook preserve the Template as a Template rather than converting it into a message to be sent. If there is a way to keep it as a template then I suspect the second part of the problem, directly saving it as a template, is probably solved.

    The frustration presently is in opening the template using the following code (tbFileLocation" is the fully qualified file path and template file; i.e., "C:\Users\me\Documents\Peanuts.oft"):

    Please Login or Register  to view this content.
    Is this possible? Possibly "CreateItemFromTemplate" is my mistake?

    It is a huge inconvenience that every time one manually selects to save as a template Outlook insists on switching back to the default central location-

    Thank-you very much, folks-

  2. #2
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    579

    Re: Excel VBA Open Outlook Template as a template for editing

    No problem Bruce!

    I know this isn't exactly what you were looking for, but this will get the job done:

    Take a look at this first.

    All you need do is to establish the "MailItem" variable as a public object, let's call it "oPubOutMail", and for simplicity's sake, another public String variable which we will call "strPubOFTFileLocation".

    Change your previous code as follows:
    Please Login or Register  to view this content.
    Now create another command button labeled "Save Template" or the like that includes the following code:

    Please Login or Register  to view this content.
    (We use the numeral "2" instead of the keyword "olTemplate" because you are using Late Binding, though you could have placed a public enumeration in your code as Cytop showed you how to do on another one of your inquiries as well)

    Open the template as you would normally do and make your edits.

    Once done, run the above code along with any other actions you need like setting visibility of various buttons and the like; it will save the file to the intended location.

    Just a note: the file will be saved, but remains open. It can be hidden by other open programs so you will want to close that out too. I will ask you if you wish to save it, but you don't, as it is meaning if you want to save it as a regular mail item.

    It's great to be schizophrenic. I would give my other self a reputation star for this if I could.

    Posted in case anyone else in the future is looking for a similar solution.

  3. #3
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    579

    Re: Excel VBA Open Outlook Template as a template for editing

    By the way Bruce, if you want to make that email that opened up go away, then just modify that last bit of code to:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Open Outlook Template and Need Subject Line
    By TMcKay in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-11-2015, 05:21 PM
  2. Create Outlook Template (.oft) from Excel file
    By dkeller33 in forum Outlook Formatting & Functions
    Replies: 2
    Last Post: 11-25-2014, 03:36 PM
  3. Replies: 1
    Last Post: 07-17-2013, 08:10 AM
  4. Replies: 3
    Last Post: 07-17-2013, 08:10 AM
  5. Sent excel template through outlook
    By Velmortis in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-04-2013, 09:55 PM
  6. Sending of outlook using Excel with template
    By jja082 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-21-2013, 05:15 PM
  7. Replies: 2
    Last Post: 05-20-2011, 07:26 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1