Information générale
Catégorie:
Codage, syntaxe et commandes
I realize that was the case prior to going to bed. I'll have to come up with an alternate solution. Thanks.
>The preprocessor run only once, before compiling the source code. Since the preprocessor can't see inside the macro, it cannot replace constants like wdWindowStateMaximize. Which mean that you will receive an error message at run time, since wdWindowStateMaximize doesn't say anything to the called method. It expect a numeric value.
>
>Your second method work, because the preprocessor see the constant and can change it by it's numeric equivalent before the compilation is done.
>
>Since you want to be able to run code inside a memo field, the only solution I see is to ignore the constant (wdWindowStateMaximize) and to use their numeric equivalent instead.
>
>HTH
>
>>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
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