Hi guys,
Just wondering where I can find all the API for ActiveX and possibly some script examples from you guys?
Currently I am trying to insert some text in office word through Autocad and replace some text with some symbols. How can I do this? I try to change the string in my script to character Unicode before exporting to office word but then I realise I still need to press ALT+X in word to make that happen. So what is the best way to do so?
Thank you guys.
It's a rather broad topic and non trivial for someone starting out. The following is incomplete but it's what I can ante up given my time allowance.
You can use
this to identify the ProgID to use to instantiate a word document:
Example: (_FindProjIDs "word*"):
Output: (
"Word.Application.14"
"Word.Basic.9"
"Word.Document.12"
"Word.Document.6"
"Word.Document.8"
"Word.DocumentMacroEnabled.12"
"Word.OpenDocumentText.12"
"Word.Picture.6"
"Word.Picture.8"
"Word.Template.12"
"Word.TemplateMacroEnabled.12"
"WordDocument"
"WordPad.Document.1"
)Generally speaking, you'd be looking for the highest number associated with a document type descriptor. In this case I might try "Word.Document.12".
e.g.
(setq wd (vlax-create-object "Word.Document.12"))
>> #<VLA-OBJECT _Document 000000008cb2b398>
(vlax-dump-object wd t)
; _Document: nil
; Property values:
; ActiveTheme (RO) = "none"
; ActiveThemeDisplayName (RO) = "none"
; ActiveWindow (RO) = #<VLA-OBJECT Window 000000008cb1f2a8>
; ActiveWritingStyle = ...Indexed contents not shown...
; Application (RO) = #<VLA-OBJECT _Application 000000008cb1f778>
; AttachedTemplate = #<VLA-OBJECT Template 000000008cb1f858>
; AutoFormatOverride = 0
; AutoHyphenation = 0
; Background = #<VLA-OBJECT Shape 000000008cb1ec88>
; Bibliography (RO) = #<VLA-OBJECT Bibliography 000000008cb1eb38>
; Bookmarks (RO) = #<VLA-OBJECT Bookmarks 000000008cb1ea58>
; BuiltInDocumentProperties (RO) = #<VLA-OBJECT DocumentProperties 000000008cb1de18>
; Characters (RO) = #<VLA-OBJECT Characters 000000008cb1edd8>
; ChildNodeSuggestions (RO) = #<VLA-OBJECT XMLChildNodeSuggestions 000000008cb1dc58>
; ClickAndTypeParagraphStyle = #<VLA-OBJECT Style 000000008cb1e748>
; CoAuthoring (RO) = #<VLA-OBJECT CoAuthoring 000000008cb1e5f8>
; CodeName (RO) = "ThisDocument"
; CommandBars (RO) = #<VLA-OBJECT _CommandBars 000000008cb1e828>
; Comments (RO) = #<VLA-OBJECT Comments 000000008cb1e048>
; Compatibility = ...Indexed contents not shown...
; CompatibilityMode (RO) = 14
; ConsecutiveHyphensLimit = 0
; Container (RO) = Microsoft Word: This property is only available if the document is an OLE object.
; Content (RO) = #<VLA-OBJECT Range 000000008cb1e358>
; ContentControls (RO) = #<VLA-OBJECT ContentControls 000000008cb20818>
; ContentTypeProperties (RO) = Microsoft Word: This document must contain Content Type properties. Content Type properties are a common requirement for files in a document management system.
; Creator (RO) = 1297307460
; CurrentRsid (RO) = 11282357
; CustomDocumentProperties (RO) = #<VLA-OBJECT DocumentProperties 000000008cb1e278>
; CustomXMLParts (RO) = #<VLA-OBJECT _CustomXMLParts 000000008cb1e208>
; DefaultTableStyle (RO) = #<VLA-OBJECT Style 000000008cb1e198>
; DefaultTabStop = 36.0
; DefaultTargetFrame = ""
; DisableFeatures = 0
; DisableFeaturesIntroducedAfter = Exception occurred
; DocumentInspectors (RO) = #<VLA-OBJECT DocumentInspectors 000000008cb1da28>
; DocumentLibraryVersions (RO) = No versions exist for this file.
; DocumentTheme (RO) = #<VLA-OBJECT OfficeTheme 000000008cb1dd38>
; DoNotEmbedSystemFonts = -1
; Email (RO) = #<VLA-OBJECT Email 000000008cb1db08>
; EmbedLinguisticData = -1
; EmbedTrueTypeFonts = 0
; EncryptionProvider = ""
; Endnotes (RO) = #<VLA-OBJECT Endnotes 000000008cb1dbe8>
; EnforceStyle = 0
; Envelope (RO) = #<VLA-OBJECT Envelope 000000008cb1d718>
; FarEastLineBreakLanguage = 0
; FarEastLineBreakLevel = 0
; Fields (RO) = #<VLA-OBJECT Fields 000000008cb1d2b8>
; Final = 0
; Footnotes (RO) = #<VLA-OBJECT Footnotes 000000008cb1d8d8>
; FormattingShowClear = -1
; FormattingShowFilter = 5
; FormattingShowFont = 0
; FormattingShowNextLevel = -1
; FormattingShowNumbering = 0
; FormattingShowParagraph = 0
; FormattingShowUserStyleName = 0
; FormFields (RO) = #<VLA-OBJECT FormFields 000000008cb1d408>
; FormsDesign (RO) = 0
; Frames (RO) = #<VLA-OBJECT Frames 000000008cb1d478>
; Frameset (RO) = Microsoft Word: The Document.Frameset property is only available when Document.Type is WdFrameset
; FullName (RO) = "Document2"
; GrammarChecked = -1
; GrammaticalErrors (RO) = #<VLA-OBJECT ProofreadingErrors 000000008cb202d8>
; GridDistanceHorizontal = 9.0
; GridDistanceVertical = 9.0
; GridOriginFromMargin = -1
; GridOriginHorizontal = 72.0
; GridOriginVertical = 72.0
; GridSpaceBetweenHorizontalLines = 1
; GridSpaceBetweenVerticalLines = 1
; HasMailer = Not implemented
; HasPassword (RO) = 0
; HasVBProject (RO) = 0
; HTMLDivisions (RO) = #<VLA-OBJECT HTMLDivisions 000000008cb20ce8>
; Hyperlinks (RO) = #<VLA-OBJECT Hyperlinks 000000008cb20c78>
; HyphenateCaps = -1
; HyphenationZone = 18
; Indexes (RO) = #<VLA-OBJECT Indexes 000000008a80ebf8>
; InlineShapes (RO) = #<VLA-OBJECT InlineShapes 000000008a810088>
; IsMasterDocument (RO) = 0
; IsSubdocument (RO) = 0
; JustificationMode = 0
; KerningByAlgorithm = -1
; Kind = 0
; LanguageDetected = 0
; ListParagraphs (RO) = #<VLA-OBJECT ListParagraphs 00000001064ce218>
; Lists (RO) = #<VLA-OBJECT Lists 00000001064ced08>
; ListTemplates (RO) = #<VLA-OBJECT ListTemplates 000000008a80ea38>
; LockQuickStyleSet = 0
; LockTheme = 0
; MailEnvelope (RO) = #<VLA-OBJECT IMsoEnvelopeVB 000000008a80e9c8>
; Mailer (RO) = Not implemented
; MailMerge (RO) = #<VLA-OBJECT MailMerge 000000008a80eb88>
; Name (RO) = "Document2"
; NoLineBreakAfter = ""
; NoLineBreakBefore = ""
; OMathBreakBin = 0
; OMathBreakSub = 0
; OMathFontName = "Cambria Math"
; OMathIntSubSupLim = -1
; OMathJc = 1
; OMathLeftMargin = 0.0
; OMathNarySupSubLim = 0
; OMathRightMargin = 0.0
; OMaths (RO) = #<VLA-OBJECT OMaths 000000008a80e728>
; OMathSmallFrac = 0
; OMathWrap = 72.0
; OpenEncoding (RO) = 1200
; OptimizeForWord97 = 0
; OriginalDocumentTitle (RO) = Microsoft Word: That property is not available on that object.
; PageSetup = #<VLA-OBJECT PageSetup 000000008a80e6b8>
; Paragraphs (RO) = #<VLA-OBJECT Paragraphs 000000008a80e568>
; Parent (RO) = #<VLA-OBJECT _Application 000000008cb1f778>
; Password (RO) = ...Indexed contents not shown...
; PasswordEncryptionAlgorithm (RO) = ""
; PasswordEncryptionFileProperties (RO) = -1
; PasswordEncryptionKeyLength (RO) = 0
; PasswordEncryptionProvider (RO) = ""
; Path (RO) = ""
; Permission (RO) = Exception occurred
; PrintFormsData = 0
; PrintFractionalWidths = Not implemented
; PrintPostScriptOverText = 0
; PrintRevisions = -1
; ProtectionType (RO) = -1
; ReadabilityStatistics (RO) = #<VLA-OBJECT ReadabilityStatistics 00000000463cfbd8>
; ReadingLayoutSizeX = 0
; ReadingLayoutSizeY = 0
; ReadingModeLayoutFrozen = 0
; ReadOnly (RO) = 0
; ReadOnlyRecommended = 0
; RemoveDateAndTime = 0
; RemovePersonalInformation = 0
; Research (RO) = #<VLA-OBJECT Research 000000008a80e488>
; RevisedDocumentTitle (RO) = Microsoft Word: That property is not available on that object.
; Revisions (RO) = #<VLA-OBJECT Revisions 000000008a80e3a8>
; Saved = -1
; SaveEncoding = 1200
; SaveFormat (RO) = 12
; SaveFormsData = 0
; SaveSubsetFonts = 0
; Scripts (RO) = #<VLA-OBJECT Scripts 000000008a80e258>
; Sections (RO) = #<VLA-OBJECT Sections 000000008a80e178>
; Sentences (RO) = #<VLA-OBJECT Sentences 000000008a80e098>
; ServerPolicy (RO) = Exception occurred
; Shapes (RO) = #<VLA-OBJECT Shapes 000000008a80e028>
; ShowGrammaticalErrors = -1
; ShowRevisions = -1
; ShowSpellingErrors = -1
; Signatures (RO) = #<VLA-OBJECT SignatureSet 000000008a80df48>
; SmartDocument (RO) = #<VLA-OBJECT SmartDocument 000000008a80ddf8>
; SnapToGrid = 0
; SnapToShapes = -1
; SpellingChecked = -1
; SpellingErrors (RO) = #<VLA-OBJECT ProofreadingErrors 000000008a80dd88>
; StoryRanges (RO) = #<VLA-OBJECT StoryRanges 000000008a80dca8>
; Styles (RO) = #<VLA-OBJECT Styles 000000008a80db58>
; StyleSheets (RO) = #<VLA-OBJECT StyleSheets 000000008a80d148>
; StyleSortMethod = 1
; Subdocuments (RO) = #<VLA-OBJECT Subdocuments 000000008a80dae8>
; Sync (RO) = #<VLA-OBJECT Sync 000000008a80cea8>
; Tables (RO) = #<VLA-OBJECT Tables 000000008a80d8b8>
; TablesOfAuthorities (RO) = #<VLA-OBJECT TablesOfAuthorities 000000008a80d7d8>
; TablesOfAuthoritiesCategories (RO) = #<VLA-OBJECT TablesOfAuthoritiesCategories 000000008a80d848>
; TablesOfContents (RO) = #<VLA-OBJECT TablesOfContents 000000008a80d6f8>
; TablesOfFigures (RO) = #<VLA-OBJECT TablesOfFigures 000000008a80d3e8>
; TextEncoding = 1252
; TextLineEnding = 0
; TrackFormatting = -1
; TrackMoves = -1
; TrackRevisions = 0
; Type (RO) = 0
; UpdateStylesOnOpen = 0
; UseMathDefaults = -1
; UserControl = -1
; Variables (RO) = #<VLA-OBJECT Variables 000000008a80d998>
; VBASigned (RO) = 0
; VBProject (RO) = Microsoft Word: Programmatic access to Visual Basic Project is not trusted.
; WebOptions (RO) = #<VLA-OBJECT WebOptions 000000008a80d378>
; Windows (RO) = #<VLA-OBJECT Windows 000000008a80cce8>
; WordOpenXML (RO) = <huge snip>
; Words (RO) = #<VLA-OBJECT Words 000000008a80d228>
; WritePassword (RO) = ...Indexed contents not shown...
; WriteReserved (RO) = 0
; XMLHideNamespaces = 0
; XMLNodes (RO) = #<VLA-OBJECT XMLNodes 000000008a80bcb8>
; XMLSaveDataOnly = 0
; XMLSaveThroughXSLT = ""
; XMLSchemaReferences (RO) = #<VLA-OBJECT XMLSchemaReferences 000000008a80cc08>
; XMLSchemaViolations (RO) = #<VLA-OBJECT XMLNodes 000000008a80c968>
; XMLShowAdvancedErrors = 0
; XMLUseXSLTWhenSaving = 0
; _CodeName = "ThisDocument"
; Methods supported:
; AcceptAllRevisions ()
; AcceptAllRevisionsShown ()
; Activate ()
; AddToFavorites ()
; ApplyDocumentTheme (1)
; ApplyQuickStyleSet2 (1)
; ApplyTheme (1)
; AutoFormat ()
; CanCheckin ()
; CheckConsistency ()
; CheckGrammar ()
; CheckIn (3)
; CheckInWithVersion (4)
; CheckSpelling (12)
; Close (3)
; ClosePrintPreview ()
; Compare (
; ComputeStatistics (2)
; Convert ()
; ConvertAutoHyphens ()
; ConvertNumbersToText (1)
; ConvertVietDoc (1)
; CopyStylesFromTemplate (1)
; CountNumberedItems (2)
; CreateLetterContent (31)
; DataForm ()
; DeleteAllComments ()
; DeleteAllCommentsShown ()
; DeleteAllEditableRanges (1)
; DeleteAllInkAnnotations ()
; DetectLanguage ()
; DowngradeDocument ()
; EditionOptions (4)
; EndReview ()
; ExportAsFixedFormat (15)
; FitToPages ()
; FollowHyperlink (7)
; ForwardMailer ()
; FreezeLayout ()
; GetCrossReferenceItems (1)
; GetLetterContent ()
; GetWorkflowTasks ()
; GetWorkflowTemplates ()
; GoTo (4)
; LockServerFile ()
; MakeCompatibilityDefault ()
; ManualHyphenation ()
; Merge (5)
; Post ()
; PresentIt ()
; PrintOut (18)
; PrintPreview ()
; Protect (5)
; Range (2)
; Redo (1)
; RejectAllRevisions ()
; RejectAllRevisionsShown ()
; Reload ()
; ReloadAs (1)
; RemoveDocumentInformation (1)
; RemoveLockedStyles ()
; RemoveNumbers (1)
; RemoveTheme ()
; Repaginate ()
; Reply ()
; ReplyAll ()
; ReplyWithChanges (1)
; ResetFormFields ()
; RunAutoMacro (1)
; RunLetterWizard (2)
; Save ()
; SaveAs2 (17)
; SaveAsQuickStyleSet (1)
; Select ()
; SelectAllEditableRanges (1)
; SelectContentControlsByTag (1)
; SelectContentControlsByTitle (1)
; SelectLinkedControls (1)
; SelectNodes (3)
; SelectSingleNode (3)
; SelectUnlinkedControls (1)
; SendFax (2)
; SendFaxOverInternet (3)
; SendForReview (4)
; SendMail ()
; SendMailer (2)
; SetCompatibilityMode (1)
; SetDefaultTableStyle (2)
; SetLetterContent (1)
; SetPasswordEncryptionOptions (4)
; ToggleFormsDesign ()
; TransformDocument (2)
; Undo (1)
; UndoClear ()
; Unprotect (1)
; UpdateStyles ()
; UpdateSummaryProperties ()
; ViewCode ()
; ViewPropertyBrowser ()
; WebPagePreview ()Beyond that it would be to you signficant advantage to (1) understand AutoCAD Activex Programming via LISP, (2) know how to translate VBA / VBScript to LISP, (3) find VB / VBScript code that does want you want via google, (4) translate to LISP. Wallah.