Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Display Problem with Excel Textboxes
Message
De
17/01/2004 08:25:21
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00867646
Message ID:
00867780
Vues:
17
>Hi All,
>
>I'm attempting to change the Text(Value)of an Excel Workbook Textbox using Automation from VFP. I'am able to change the the Text (Value) property using code like by using code such as:
>
>oExcel = CREATEOBJECT("Excel.Application")
>oWorkBook = oExcel.Workbooks.Add("Some File Name")
>oSheet = oWorkBook.ActiveSheet
>
>WITH oSheet
> .txt1.Text = "Some Text 1"
> .txt2.Text = "Some Text 2"
> .txt1.Text = "Some Text 3"
>ENDWITH && oSheet
>
>oExcel.Visible = .T.
>oSheet.Activate()
>
>When I view the Spreadsheet, even though the Text (Value) property has the info I set from VFP, the info is not displaying in Excel.
>
>An alternate approach which seems to work is to link the Excel text box values (via the Linked Cell Textbox Property) to a (hidden) cell in the spreadsheet and set the value using standard code like:
>
>oSheet.Range("Some Cell").Value = "Some Text 1"
>
>Has anyone dealt with this issue? Is the alternate approach the practical way to go about acheiving this result?

Make the Excel visible before assigning Text. ie :
oExcel = CREATEOBJECT("Excel.Application")
with oExcel
 .Visible = .t.
 .Workbooks.Add("Some File Name.xlt")
 with .ActiveWorkBook.ActiveSheet
*    .txt1.Text = "Some Text 1"
    .txt2.Text = "Some Text 2"
    .txt1.Text = "Some Text 3"
 endwith
endwith
PS: If you want to make visible later use Value property not Text. But actually text works too. It might be that text is not autosized and not fitting there.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform