Afficher un message
Vieux 10/03/2008, 00h03   #1
djlewis
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Keyword arguments for WIN32OLE?

Is there a way to pass ~keyword~ arguments to a WIN32OLE method in
Ruby? For example, I've tried...

@selection.Find.Execute( :FindText=>"look
for", :ReplaceWith=>"something else")

.... and the same with the arguments as an explicit hash. They don't
work. I'm reduced to using terribly ugly, error-prone things like...

def replace( find, replace)
@selection.Find.Execute( find, nil, nil, nil, nil, nil, nil, nil,
nil, replace)
end

which is OK once set up. But translating ruby-style hash keyword
arguments to WIN32OLE keyword arguments would be tremendous .

BTW, the VBA function used above is...

expression.Execute(FindText, MatchCase, MatchWholeWord,
MatchWildcards, MatchSoundsLike, MatchAllWordForms, Forward, Wrap,
Format, ReplaceWith, Replace, MatchKashida, MatchDiacritics,
MatchAlefHamza, MatchControl)

Thanks. --David.
  Réponse avec citation
 
Page generated in 0,05692 seconds with 9 queries