+ Reply to Thread
Results 1 to 6 of 6

Create folder & export sheet, not working

  1. #1
    Forum Contributor rinser's Avatar
    Join Date
    02-27-2009
    Location
    Bucharest
    MS-Off Ver
    MS Office 2013
    Posts
    103

    Create folder & export sheet, not working

    Hi everybody,

    I was working on some code that would create a new folder in My Documents and within that folder export the current worksheet and save it there with a particular name. After doing so I need it to return to the original worksheet and clear contents.
    I would also need to export to the new sheet only contents of the cells without any macros or buttons.
    If someone has any idea what is wrong with my code please help!


    Please Login or Register  to view this content.
    Last edited by rinser; 05-29-2009 at 07:52 AM.

  2. #2
    Forum Contributor rinser's Avatar
    Join Date
    02-27-2009
    Location
    Bucharest
    MS-Off Ver
    MS Office 2013
    Posts
    103

    Re: Create folder & export sheet, not working

    I am surprised nobody knows how to solve this. I guess people are just gone fishing!
    I also posted this topic here, please check it:

    http://www.vbaexpress.com/forum/show...271#post186271

    Cheers!

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Create folder & export sheet, not working

    When you say it doesn't work - which bit -- as I see it all but the clearcontents should work ... as is you're clearing contents of the new file as opposed to the old.

    Please Login or Register  to view this content.
    Be wary of how you declare variables... in VBA this:

    Please Login or Register  to view this content.
    declares a & b as Variants, only c is a String... (unlike .NET) you should therefore use

    Please Login or Register  to view this content.
    If the sheet contains code / objects your best bet would be to cre*ate a new workbook from scratch and then copy / paste values / formats etc from the main file to the new file (ie don't copy the sheet).

  4. #4
    Forum Contributor rinser's Avatar
    Join Date
    02-27-2009
    Location
    Bucharest
    MS-Off Ver
    MS Office 2013
    Posts
    103

    Re: Create folder & export sheet, not working

    Thanks a lot DonkeyOte!
    It works now
    Only thing is in the workbook that is exported remains the button and module that generated it. I wonder if it's posible to get rid of it so that the final user sees only what was on the sheet. This only if it's not very complicated, otherwise it's not a big deal.
    Cheers!

  5. #5
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Create folder & export sheet, not working

    The method that I used in this thread might help. http://www.excelforum.com/excel-prog...ileformat.html

  6. #6
    Forum Contributor rinser's Avatar
    Join Date
    02-27-2009
    Location
    Bucharest
    MS-Off Ver
    MS Office 2013
    Posts
    103

    Re: Create folder & export sheet, not working

    That's an interesting approach Kenneth!
    Wouldn't have thought about that way in ages.
    Good thing people now have two interesting solutions (a bit different task) in one thread. Wish I had the same when looking for answers
    Thank you!

+ 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