+ Reply to Thread
Results 1 to 3 of 3

VBA saveas + shell

  1. #1
    Registered User
    Join Date
    09-02-2010
    Location
    Indiana, US
    MS-Off Ver
    Excel 2003
    Posts
    1

    VBA saveas + shell

    Long story short: I was asked to fix a broken macro, but I don't program w/ VB let alone use excel more than I'm forced to. I can read and understand whats broken with the macro, but I'd rather improve it to prevent the next poor intern from having to fix it.

    I wrote up some pseudo code to get my idea about what I'm looking to do across.

    Please Login or Register  to view this content.
    I'm just looking to save a copy of the workbook when it opens. The copy should have the same name as the workbook that opens with the extension .tmp.xls. I actually want it to be in .xls (97-2003).

    Open a shell, run python, and pass the workbook name as an argument.

    I've tried searching for subs written by other people to do these tasks, but I just can't seem to get it to work. I hit the beginner tuts and still made no progress.

    Edit: there are no other macros in the workbook.
    Edit2: code tags
    Last edited by eval(BadCode); 09-02-2010 at 10:43 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: VBA saveas + shell

    Something like...

    Please Login or Register  to view this content.
    Martin

  3. #3
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: VBA saveas + shell

    Please Login or Register  to view this content.
    is equivalent to:
    Please Login or Register  to view this content.
    (i.e. exactly as requested)
    But this will not work beautifully if the user has other workbooks open.
    maybe:
    Please Login or Register  to view this content.
    (replacing both lines quoted)

    HTH
    Last edited by Cheeky Charlie; 09-04-2010 at 11:25 AM. Reason: better code
    CC


    If you feel really indebted please consider a donation to charity. My preferred charity is ActionAid but there are plenty of worthy alternatives.

+ 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