Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Better way to code Excel automation?
Message
De
30/04/2008 12:05:22
 
 
À
29/04/2008 10:57:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01313820
Message ID:
01314234
Vues:
26
Hi Frank,

Just went through and used "cell naming" this morning to easily do what I wanted. You can do as you suggest (right-click on a range and choose "Name a range" from the list or there is a "Name manager" dialog (at least in Excel 2007). Very nifty and also cuts out code and a lot of double-checking of cell addresses in my VFP code. Now I will just need to put a wrapper function in my VFP oExcel class to trap if a user deletes a named range and to display an alert.

Also, Christof had an interesting idea using XML which I will check into as well.

Thanks mucho.
Albert

>Hi Albert,
>
>you can name cells or a range of cells in Excel. I've never done it, but I'm sure you can then use the name in Automating it. Check the Excel help for "Name cells in a workbook". Basically, when you have the cell/range selected you just click in the Name box and change the name there. For example if I am in cell A1, I click on the name A1 (to the left of the formula bar) and type in a new name.
>
>Hope this helps
>
>>Hi all,
>>
>>Is there a more maintainable way to code VFP automation of Excel other than "dead reckoning" of cells e.g.
>>
>>oExcel.ActiveWookBook.ActiveSheet.Range("B5").Value = 100
>>
>>My client has given me a very complex template to push data across to - I can see coding in hundreds of lines and then them adding a new row half way down the sheet and I have to then go in and increment every cell reference by 1 row.
>>
>>In Word, I used bookmarks to "tag" a spot in the document and so as long as the bookmark exists, I can find it and insert text. Users can therefore continue to add or change text as long as they leave the bookmarks in.
>>
>>Does Excel have the ability to "tag" a cell with a name (within the template) so that I can find the cell by name and update it's data?
>>
>>Albert
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform