Information générale
Catégorie:
Codage, syntaxe et commandes
Titre:
Preprocessor Directors and Macro Substitution
After veiwing a session with Word and Excel at the recent Developers conference. I decided I would implement some word automation. Using VFP 6.0 with SP3.
I'm using the word.h file found on the Foxpro Devcon CDRom. (dev04\examples)
Scenerio:
As an example I have the following Word Basic syntax stored in a FoxPro memo field.
Selection.WholeStory
Selection.Font.Size = 20
WindowState = wdWindowStateMaximize
ActiveDocument.PageSetup.LineNumbering.Active = .F.
ActiveDocument.PageSetup.OddAndEvenPagesHeaderFooter = .F.
ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = .F.
I'm reading each line of code using mLine() and Memline() and executing macro substitution as follows:
lcVBACode = "loWord." + alltrim(lcMemLine)
&lcVBACode
All the word Basic code runs find except any word basic code which includes a preprocessor directive i.e. wdWindowStateMaximize. I receive an error message stating the variable "wdWindowStateMaximize" is not found.
I have tried using #include word.h, #Define wdWindowStateMaximize 1. Nothing seems to work with macro substitution.
However, if I implemented the following code, it would work.
lcVBACode = "loWord.WindowState = " + alltrim(str(wdWindowStateMaximize))
&lcVBACode
Any help would be appreciated.
David Ginn
DNA Computing, inc.
410-625-9514
Suivant
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