Jump to content


tkv89

Member Since 27 Sep 2005
Offline Last Active Dec 06 2012 03:03 PM
-----

Posts I've Made

In Topic: Question on DDE_EXECUTE

10 May 2010 - 07:09 AM

Thanks, but it still doesn't work for me :lol:

I'll try to do more experiments and see if I can have any luck.



Sorry I took so long to update this, was at a customer's site. Anyway, check with the following snippet. I'm using it now and there's no problem with renaming

#STAT = DDE_REQUEST('EXCEL','SYSTEM','SELECTION', $SHEET)
#POS = INDEX($SHEET,'!')
$SHEET = $SHEET(1, (#POS - 1))
$RAW_COTTON_SHEET = $SHEET

#POS2 = INDEX($SHEET,']')
$WORKBOOK = $SHEET(1, (#POS2))
$WORKBOOK_REF = $SHEET(2, (#POS2 - 1))
$RAW_COTTON_NAME = $WORKBOOK + 'Raw Cotton'

$$HIDE_TABS = '[OPTIONS.VIEW(,,,,,,,,,,,,,,FALSE)]'
$$SHOW_TABS = '[OPTIONS.VIEW(,,,,,,,,,,,,,,TRUE)]'
$$RENAME_COTTON = '[WORKBOOK.NAME("' + $RAW_COTTON_SHEET + '","' + $RAW_COTTON_NAME + '")]'

#S = DDE_EXECUTE('EXCEL', $WORKBOOK_REF, $$HIDE_TABS)
#S = DDE_EXECUTE('EXCEL', $WORKBOOK_REF, $$RENAME_COTTON)
#S = DDE_EXECUTE('EXCEL', $WORKBOOK_REF, $$SHOW_TABS)

In Topic: Question on DDE_EXECUTE

03 May 2010 - 11:28 AM

...I really, really have to get out of the habit of answering fast without checking in detail.

ANYWAY, found a copy of it on my house computer.

The syntax is OPTIONS.VIEW(formula, status, notes, show_info, object_num, page_breaks, formulas, gridlines, color_num, headers, outline, zeros, hor_scroll, vert_scroll, sheet_tabs)

You're interested in the last one so your command should be [OPTIONS.VIEW(,, , , , , , , , , , , , , FALSE)] <- don't copy this exactly, may have missed a comma or two

So Hide it, rename, then show it (set to TRUE). This should work (if not, try putting the FALSE as "FALSE")

In Topic: Question on DDE_EXECUTE

03 May 2010 - 11:18 AM

Argh, forgot to put this in my previous post. There's also a slight bug in the DDE commands. The renaming will not work properly. To get around this, you'll have to hide the tabs of the worksheets, rename them, then show the tabs of the worksheets. It's one of the options in the Excel workbook (don't have the Macro help file with me at the moment). You can search around this forum and find a link to download it.


Also
#STAT = DDE_EXECUTE('EXCEL','SYSTEM',$$CMD)

I'm not sure whether this will have any impact, but I typically replace the 'SYSTEM' with the object I want to manipulate. For example, I would use
#STAT = DDE_EXECUTE('EXCEL',$WORKBOOK,$$CMD)
where $WORKBOOK contains my Workbook name. It works fine so far.

Actually, this brings me back to the core of this topic. Most of the time, if you don't specify it correctly (Which workbook, which sheet or which CHART), it fails to work. 'SYSTEM' is a catch-all that basically says "active object" (as far as I know). Why is it that it even though I specify the exact workbook, it still opens in a different workbook?....ah well......

In Topic: Question on DDE_EXECUTE

03 May 2010 - 11:11 AM

This is a bit off the forum topic :lol:

Anyway, to rename the worksheet, you have to use the full name. So instead of

'[WORKBOOK.NAME("Sheet1", "Main1"]'

you should be using

'[WORKBOOK.NAME("[Book1]Sheet1", "[Book1]Main1"]'

The name of the workbook is dynamic (based on the number of open workbooks). You'll have to get the name from a DDE_REQUEST, to play safe.....

In Topic: Question on DDE_EXECUTE

23 April 2010 - 02:30 AM

Yeah, I kinda figured that out. The problem is I can't quite figure out WHY it doesn't work, seeing as we have to be detailed enough to name the workbook we are sending the command to.