选择显示字体大小

powerbuilder with word 97

summary:this document reviews how to find the correct visual basic for application syntax needed in word and how to convert it into the correct powerbuilder syntax.
includes:
- code examples to see the powerbuilder syntax for word 8 ole automation.
- incomplete list of visulabasic constants and their values for powerbuilder
document id:47980last revised:10/28/99
topic:app developmentdocument type:technote
product:powerbuilderversion:7.0; 6.0; 5
platform:pcoperating system:windows 95, windows nt, windows 98

document:

  1. how to find the correct visual basic for applications (vba) syntax needed in word and how to convert it into the correct powerbuilder syntax

  with word 8 / office 97, microsoft changed the way applications communicate with word via ole. old wordbasic syntax may not work properly and converting them to vba equivalents may be required.

  1.1 use the word macro editor

  an easy way to determine the vba functions and their syntax by using the macro editor which is integrated in word. to obtain the vba functions turn on the macro recording in word, perform the tasks you wish the macro to perform (ie. highlight some text), and then turn off the recording. with alt + f11 you are able to open the macro editor and see the syntax used by word.

  to get a complete description of a function and to see the complete syntax you can use the help file vbawrd8.hlp which is available through a custom installation of word (you must specify to install this help file during the installation process, it is not installed by default). here you will find information regarding the functions you can use in word and their vba and wordbasic syntax. furthermore you will be instructed which functions you can use with word 8.

  1.2 convert vb syntax to the powerbuilder syntax

a. powerbuilder uses square brackets for array indices
b. functions with several values are separated by comma between round brackets
convertion example :
here you see a macro recorded with the macro editor in word.
sub macro1()
    ' vb syntax in a macro
    ' see hint a.
    selection.information(wdwithintable)

    ' see hint b.
selection.moveleft unit:=wdcharacter, count:=5

' function without values
selection.typebackspace

end sub
from the vbawrd8.hlp file, here is the definition of the moveleft() function used in the macro:

selection.moveleft(unit, count, extend)

unit optional variant: wdcell, wdcharacter, wdword or wdsentence. default = wdcharacter.
count optional: . number of units to move. default = 1.
extend optional: wdmove or wdextend

here is the syntax to call the moveleft() function

// pb syntax
ole_object.selection.information[12]
ole_object.selection.moveleft(1,5,1)
ole_object.selection.typebackspace()

  the question is now: what value does the constants "wdwithintable", "wdcharacter" contain? these are only known to ms word which prevents powerbuilder from having any knowledge about them. however each constant is associated with a value which can be used in its place. in general most of them are integers and you can display them in a message box within the macro to determine their actual value
i.e.

sub makro1()
' this is a small messagebox to find out the integer
' value of an enumerated datatype in word.
' in this case the value 5
answer = msgbox(wdline, 0)
end sub

  alternatively, micorosoft's support website has a technical article which documents all of the constants and their numerical equivalents that may be found in microsoft office. the article is id# q112671.

  in powerbuilder, you would pass the actual value of the word constant to the function. you can also declare a constant in powerscript and associate it with the same value; when calling the word function, pass it the constant you declared instead of the actual value. this allows you to make global changes easily to your code if microsoft decides to change what the value of the word constant in future releases.

  under section 3. you find a list with common constants and their numeric equivalents.

   1.3 the word object model


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons