Jump to content


Click the link below to see the new game I'm developing!


Photo
- - - - -

Excel


19 replies to this topic

#16 Vol Yip

Vol Yip

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 393 posts
  • Gender:Male
  • Location:Hong Kong

Posted 16 March 2007 - 01:45 AM

Then, if I try

$OLDNAME = 'Sheet1'
$NEWNAME = 't_Schema'
$$C = '[WORKBOOK.NAME($OLDNAME, $NEWNAME)]'
#ERROR = DDE_EXECUTE('Excel','SYSTEM',$$C)


Vol,

There is nothing wrong with this part of your code...it's correct. You just have to first SELECT the Sheet# before you attempt to change its attributes.


HTH,

AK


Hi AK,

No, it seems still doesn't work :o

#17 tkv89

tkv89

    darkstar

  • Members
  • PipPip
  • 26 posts
  • Gender:Male

Posted 16 March 2007 - 07:12 AM

Dear Vol Yip,

Try using the full workbookname[sheetname] syntax to store the old and new workbook names. It should work then. Using the sheet name only won't work

tkv

#18 Vol Yip

Vol Yip

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 393 posts
  • Gender:Male
  • Location:Hong Kong

Posted 16 March 2007 - 10:30 AM

Could you please enlighten me the sytax of this? Thanks!

#19 tkv89

tkv89

    darkstar

  • Members
  • PipPip
  • 26 posts
  • Gender:Male

Posted 16 March 2007 - 11:31 PM

Sorry I took so long to reply

Basically, after creating your new excel sheet, send a DDE Request to get the current sheet name (Can't remember the exact syntax). It should return a string similar to this
[BookXXX]Sheetyyy!R1C1....

When you rename it, use the full [BookXXX]NewSheetName and [BookXXX]OldSheetName. Also, ensure that the strings passed into the WORKBOOK.RENAME function contain double quotation marks, so using your example, the $NEWNAME should be something like
$NEW_NAME = '"[BookXXX]NewSheetName"'.

This should rename the workbook successfully

Regards
TKV

#20 Vol Yip

Vol Yip

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 393 posts
  • Gender:Male
  • Location:Hong Kong

Posted 19 March 2007 - 12:35 PM

Thanks everyone. Although I still having problem to rename the sheet, I have found a workaround for myself.

I first create a Template Excel file with all the sheets properly named.

Then when I open Excel using DDE, I start with the Template.

Then all the DDE_POKE works with the sheet name.

Finally I do a SAVE.AS to save my newly created workbook to another name.

That's works perfect for me. :D



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Click the link below to see the new game I'm developing!