Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

Passing object as parameter throws compile error - Type Mismatch

$
0
0

While using VBA, When passing object as parameter throws compile error.

 

Sub layoutAnArticle()


Dim myWordDoc As String

Dim myDocument As InDesign.Document

Dim myStory As InDesign.Story

Dim myTextFrame As InDesign.TextFrame

Dim myPage As InDesign.Page

 

Set myInDesign = CreateObject("InDesign.Application.CS6")

Set myDocument = myInDesign.Open(workingDirectory + workingFile)

Set myDocument = myInDesign.Documents.Item(1)

Set myPage = myDocument.Pages.Item(1)

myboundsarray = myGetBounds(myDocument, myPage)

Set myTextFrame = myPage.TextFrames.Add

myTextFrame.GeometricBounds = myboundsarray

myTextFrame.Place ("ScriptingTryWordDoc.docx")

Set myStory = myTextFrame.ParentStory

 

formatStoryText (myStory)

 

end sub

 

Sub formatStoryText(ByRef subStory As InDesign.Story)

 

myInDesign.FindGrepPreferences = idNothingEnum.idNothing

myInDesign.ChangeGrepPreferences = idNothingEnum.idNothing

 

myInDesign.FindGrepPreferences.FindWhat = "  +"

myInDesign.ChangeGrepPreferences.ChangeTo = " "

subStory.ChangeGrep

 

myInDesign.FindGrepPreferences.FindWhat = " *\r[ \r]*"

myInDesign.ChangeGrepPreferences.ChangeTo = "\r"

subStory.ChangeGrep

 

myInDesign.FindGrepPreferences = idNothingEnum.idNothing

myInDesign.ChangeGrepPreferences = idNothingEnum.idNothing

 

' end of formatStoryText

End Sub

 

While trying to run layoutAnArticle, it gives "Compile error: Type mismatch..." at the calling point of formatStoryText.


Viewing all articles
Browse latest Browse all 15932

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>