+ Reply to Thread
Results 1 to 3 of 3

Incorrect linked data when launching spreadsheet from a command line.

  1. #1
    Registered User
    Join Date
    02-25-2005
    Location
    Las Vegas, NV
    MS-Off Ver
    2010
    Posts
    10

    Incorrect linked data when launching spreadsheet from a command line.

    I have a spreadsheet that updates about 50 queries via a linked data source. I created an automatic macro for "on worksheet open" and the macro refreshes all connections, recalculates, saves some pdf's of the values and then quits without saving. The issue isn't getting this process to work... The issue I am having is getting this process to work when I call the spreadsheet from a batch script.

    I call it by using:
    "c:/full/path/to/excel/excel.exe" /r "c:/spreadsheet/path/here/spreadsheet.xlsm"
    (I have also tried without the read only switch)

    When I double click the spreadsheet, it works fine, opens, refreshes, saves pdfs, exits without saving.

    When I call from a command line (batch file), it opens, refreshes, takes exactly the same time as when opened manually but the data is different (wrong) on the pdf files that it saves.

    Anyone have any clue what might be going on here or what to troubleshoot next?

    (Excel 2010, Windows 2008 R2 OS)
    Last edited by kevlar3d; 08-31-2012 at 07:15 PM. Reason: More Details

  2. #2
    Registered User
    Join Date
    02-25-2005
    Location
    Las Vegas, NV
    MS-Off Ver
    2010
    Posts
    10

    Re: Incorrect linked data when launching spreadsheet from a command line.

    I think that I may have figured this out. I still don't know why it happened but I inserted a 5 minute pause between the calculate and save steps.
    Now the macro steps are:

    refresh
    calculate
    Wait 5 mins
    save pdf1
    save pdf2
    save pdf3...

    I suppose when this runs from the command line, it simply doesnt have enough time to render all of the query results before it starts saving. Like I said, it does run about 50 queries and takes about 20 minutes to complete so it is no easy task but the resultsets aren't too large. None of them are larger than 60 rows. All of the heavy lifting is done on the database server. The pause seems sortof barbaric, but this is solved for now- if anyone has any other thoughts I am open to them. I would love to remove the pause.

  3. #3
    Registered User
    Join Date
    02-25-2005
    Location
    Las Vegas, NV
    MS-Off Ver
    2010
    Posts
    10

    Re: Incorrect linked data when launching spreadsheet from a command line.

    I still have some data inconsistencies when opening by double clicking and opening from a command line. It really makes no sense to me but its happening. I even put a longer pause in there. Any suggestions would be very much appreciated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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