Information générale
Catégorie:
Codage, syntaxe et commandes
Hi Bill,
One thing to keep in mind... The big difference between VB - including VBA and VBS - and VFP - is that VB supports named arguments. So, you can pass arguments in any order - if they are named. Otherwise, you need to pass the arguments in the default order - as specified by the language. Now, you may say to yourself - "I can just copy and paste code from the macro recorder - remove the names - and everything will work.."
NOPE!!
The macro recorder has lots of little kludgy items that can drive you nuts. For one thing, the macro recorder may not place arguments in the default order. To be sure of the default order of arguments - be sure to check out the object browser - by pressing F2 in the VB editor of the office app you are using. Also, the macro may not provide all of the required parameters. Often, the macro recorder will bypass optional arguments. This may or may not cause you problems. If in VFP, you need to pass the first, third, and fifth arguments - as specified by VB - then you must pass the second, and fourth arguments as well. Remember, VFP does not support named arguments - so the order of things is crucial. When you don't do this, you may get the dredded data type mismatch error. Often, you can just send a place holder like MyMethod(1,,2,,3). VB will usually use the default value and you will not have problems.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement