Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 27 FEB 2007 11:48:55AM Hans Stek wrote:

Hi,

For the OLE / Excel Buffs amongst you..

Below is a snippet of my code to do with reading a Date from an Excel Spreadsheet.

The problem is that if the column of the read cell is too small for the date to display ######## is returned, same as you would see on screen.

So question is how can I set / change the column width if this happens? (Manual change is no option). I know there is a VBScript statement ActiveCell.ColumnWidth but I have had no luck translating it to OI. (Maybe to do with not setting the active cell correct?)

=============================================

oXl=OleCreateInstance('excel.Application')

oWkbks=oXl-]WorkBooks

oSheet=OleGetProperty(oWkbks, 'Open', filename, 0, 1, 1, Password)

oXl-]Visible=0

oCells=OleGetProperty(oSheet, 'Worksheets',1)

Cell=OleGetProperty(oCells,'Cells',9,12)

cRec=Iconv(Cell-]Text, 'D')

close=OleCallMethod(oSheet, 'Close',0)

close=OleCallMethod(oXL, 'Quit')

=============================================

Thank you,

Hans.


At 27 FEB 2007 11:58AM Hans Stek wrote:

Don't you hate that when it happens. You spend a few hours trying to solve the problem and you find it 5 minutes after you post the question… Sorry.

Answer is use the Value variable and not the Text one:

cRec=Iconv(Cell-]Value, 'D')

Hans.

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/1b7b59a9d1ec2fd08525728f005c5ea6.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1