+ Reply to Thread
Results 1 to 7 of 7

Change the Name of a Temporary File

  1. #1
    Registered User
    Join Date
    06-14-2004
    Posts
    52

    Change the Name of a Temporary File

    I have a macro that will make a copy of one sheet and send it out via email.

    But the name of the temporary file is always called "Book1.xls" and the number steps up each time.

    I would like to name the file that gets sent as the same name as the subject line
    Please Login or Register  to view this content.
    I did note that if I change statement
    Please Login or Register  to view this content.
    to True it would save the file in this folder: "C:\Program Files\Common Files\System\MSMAPI\1033".

    I do not want to keep the temporary file on my PC. Any ideas on how to rename the Book1.xls to
    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello whisperinghill,

    Save the file then remove it.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    06-14-2004
    Posts
    52
    Leith, that didn't quite work, but I understand it
    here are the changed portions of the code

    Please Login or Register  to view this content.
    When it gets to the Save changes, it brings up the save Book1.xls? dialog box
    I think what is missing is a line something like this before it sends the message
    Please Login or Register  to view this content.
    But this doesn't work.
    More help?

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello mkebe84,

    Let's try this approach. This will close a new workbook without saving or prompting.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  5. #5
    Registered User
    Join Date
    06-14-2004
    Posts
    52
    No The idea was to name the temporary file that was to be sent and the deleted.

    Here is waht works
    Please Login or Register  to view this content.
    What should have worked was
    Please Login or Register  to view this content.
    But it didn't. Though I really don't want it to delete all the .xls files possibly that may be there temprarily.
    What I have now works with one exception and that is, when it creates the temporary file, before saving it with the new name is asks if I want to save file Book1.xls. I want to just do the work and not ask any questions and require another click. What is the easy way to have the macro click the yes box on the pup-up?

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello whisperinghill,

    Since the default button of the Save Changes dialog is "Yes", we can have the system "click" it for us.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  7. #7
    Registered User
    Join Date
    06-14-2004
    Posts
    52
    Worked like a charm! Thanks for all input

    Here was the final code which copies one single shhet of the workbook, names it from a named range within the worksheet with date added and then send an email with it as an attachment with the Subject named the same as the file, minus the .xls

    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)

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