+ Reply to Thread
Results 1 to 17 of 17

Excel renaming file with a No.1 extension when opening excel template

  1. #1
    Registered User
    Join Date
    10-14-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    82

    Excel renaming file with a No.1 extension when opening excel template

    Hi
    I have created a template with userforms, txt boxes and buttons and i have coded the sheet to embed within a word document, it all works fine when i use the template file but when i open the template xltm it renames it xltm1 and the code doesnt work can some please explain what i need to do.

    thanks in advance

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Excel renaming file with a No.1 extension when opening excel template

    please, paste here your code
    If solved remember to mark Thread as solved

  3. #3
    Forum Contributor
    Join Date
    01-18-2013
    Location
    Prague, Czech rep.
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    138

    Re: Excel renaming file with a No.1 extension when opening excel template

    Hi Molesy,

    I think the problem is that you have xltm already opened or there is some background thing runin which forces the application to index itself...than the error prolly occurs when you try to switch between the windows right? (when you try to address your template file)...you can get around this if you declare your template name as variable at the start which will hold the actual file name nomatter what it is, even if it changes and use this variable instead of absolute string

    Best regards

    Soul

    EDIT: btw. use this function to get the file name:

    Please Login or Register  to view this content.
    Last edited by SoulPrisoner; 09-12-2013 at 07:09 AM. Reason: typo & additional info

  4. #4
    Registered User
    Join Date
    10-14-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Excel renaming file with a No.1 extension when opening excel template

    Please Login or Register  to view this content.

    Thanks


    Moderator Note:

    Pls use code tags arount your code according to rule#3 of our Forum.This time i did for you.

    We are waiting next time to do yourself.

    Thanks.
    Last edited by Fotis1991; 09-12-2013 at 07:15 AM. Reason: Added code tags

  5. #5
    Registered User
    Join Date
    10-14-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Excel renaming file with a No.1 extension when opening excel template

    Hi Soulprisoner
    where would i put that code
    thanks

  6. #6
    Forum Contributor
    Join Date
    01-18-2013
    Location
    Prague, Czech rep.
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    138

    Re: Excel renaming file with a No.1 extension when opening excel template

    uh, expected something diffrent as a code (easier to find where the error occurs) but nvm, where exactly you´re getting the error (what is yellowed)?

  7. #7
    Registered User
    Join Date
    10-14-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Excel renaming file with a No.1 extension when opening excel template

    Hi
    There is nothing yellowed, do i put the code under the click command with the button or into a module, not sure how it would activate. sorry but i am a newbie to this

  8. #8
    Registered User
    Join Date
    10-14-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Excel renaming file with a No.1 extension when opening excel template

    thanks but what is a tag?

  9. #9
    Forum Contributor
    Join Date
    01-18-2013
    Location
    Prague, Czech rep.
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    138

    Re: Excel renaming file with a No.1 extension when opening excel template

    you put that in the module....but as it stands it will not remove your issue, its just a tool to work with, so first you need to find the issue.

    btw. im bit confused, if you´re not getting run-time or whatever that stops you from execution (which would result in yellowed line) what is the problem than?

    Indexing file means you might be saving to the location where the file of the same name already exists, or you´re openin file that is already opened, its a OS thing, to keep track on the stuff that is running

    EDIT: seems like I could have misunderstood your initial question
    Last edited by SoulPrisoner; 09-12-2013 at 07:41 AM.

  10. #10
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Excel renaming file with a No.1 extension when opening excel template

    molesy

    Pls...You are almost 1 year member here. Did you ever read the forum rules? You should do it.

    Rule#3 describes what you have to do posting a code.

    Also see this.

    Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    Thanks.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  11. #11
    Registered User
    Join Date
    10-14-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Excel renaming file with a No.1 extension when opening excel template

    Hi
    Not sure if i have explained properly, when i open the xltm file it automatically opens and renames xltm1, and the code does not work when i active the userform because i am in xltm1 file, if i active the userform it activates the xltm file which hides behind the xltm1 file. if i then close the xltm1 file i can then work within the template and it works.

  12. #12
    Forum Contributor
    Join Date
    01-18-2013
    Location
    Prague, Czech rep.
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    138

    Re: Excel renaming file with a No.1 extension when opening excel template

    So, on opening one file you actualy open two of them?

    EDIT:Ok, I might have found out what you´re talking about, jsut saved empty workbook with the ending you´re talking about, its name is book1 but when i open it its book11....so this is your issue right?
    Last edited by SoulPrisoner; 09-12-2013 at 08:00 AM. Reason: additional msg

  13. #13
    Registered User
    Join Date
    10-14-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Excel renaming file with a No.1 extension when opening excel template

    Yes, exactly that.

  14. #14
    Forum Contributor
    Join Date
    01-18-2013
    Location
    Prague, Czech rep.
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    138

    Re: Excel renaming file with a No.1 extension when opening excel template

    hm, thinking of it and I cant exactly tell atm, I mean i dont see where in your code it should be causing an issue since you´re restraining yourself from using absolutes (targeting files with their names - which is what i thought was the issue, and there went my suggestion with the function; but as for now implementing that function doesnt seem to be of any use). will think about it a bit more but dunno atm, sorry

    (at least the problem was thoroughly described for others...;-)....always search for the bright sides of things u know...

    Soul

  15. #15
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Excel renaming file with a No.1 extension when opening excel template

    if you open a template by double clicking it in explorer you get a new workbook based on the template and a 1 will be appended to the template name. if you want to open the actual template file open it from within excel or right-click it in explorer and choose Open
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  16. #16
    Forum Contributor
    Join Date
    01-18-2013
    Location
    Prague, Czech rep.
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    138

    Re: Excel renaming file with a No.1 extension when opening excel template

    Quote Originally Posted by JosephP View Post
    if you open a template by double clicking it in explorer you get a new workbook based on the template and a 1 will be appended to the template name. if you want to open the actual template file open it from within excel or right-click it in explorer and choose Open
    :-D kinda simple lol...honestly since i dont use xltm i wouldnt really thought of this one, lets see if OP is happy with it but tried and seems it should be the way

  17. #17
    Registered User
    Join Date
    10-14-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Excel renaming file with a No.1 extension when opening excel template

    thanks anyway

+ 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. [SOLVED] Error:Invalid File format,while opening an Excel Template file
    By Saurabh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-02-2022, 06:50 AM
  2. How do I stop automatic opening template of any excel file
    By john55 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-28-2011, 06:06 AM
  3. Replies: 1
    Last Post: 05-26-2010, 07:56 AM
  4. Replies: 0
    Last Post: 11-08-2007, 04:14 AM
  5. Replies: 0
    Last Post: 09-26-2007, 11:52 AM

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