Message 1 of 2
passing optional vba arguments to vba (dll) from vlisp...

Not applicable
05-30-2005
07:07 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hi
i was wondering if it was possible to pass optional vba arguments to vba
from vlisp...i've tried a few different ways (that i could think of) but
neither of them seem to work...
'vba (TestDLL.dll -> cTestClass)
public sub test (byval sMsg as string, byval sOptionalString as string = "",
optional bShowMessage as boolean = true)
if bShowMessage = true then
If not sOptionalString = "" then
msgbox sMsg & sOptionalString
else
msgbox sMsg
End if
end if
end sub
;lisp
(defun test (`sMsg `vOptionalList / `odCVariable `ReturnValue)
(setq `odCTest (vlax-create-object "TestDll.cTestClass"))
(vlax-invoke-method
`odCTest
'Test
`sMsg
(if (/= (cdr (assoc "OptionalString" `vOptionalList)) nil)
(cdr (assoc "OptionalString" `vOptionalList))
); doesn't work
;;; (if (/= (cdr (assoc "OptionalString" `vOptionalList)) nil)
;;; (strcat "sOptionalString := " (cdr (assoc "OptionalString"
`vOptionalList)))
;;; ); doesn't work
;;; (if (/= (cdr (assoc "OptionalString " `vOptionalList)) nil)
;;; (cdr (assoc "ShowMessage" `vOptionalList))
;;; ); doesn't work
;;; (if (/= (cdr (assoc "OptionalString " `vOptionalList)) nil)
;;; (strcat "bShowMessage := " (cdr (assoc "ShowMessage"
`vOptionalList)))
;;; ); doesn't work 'cause :vlax-false / true is not a string
)
(vlax-release-object `odCTest )
) ;test
;lisp calling function
(test
"This is a test"
(list
(cons "OptionalString" "blar blar blar optional")
(cons "ShowMessage" :vlax-true)
);list
)
any help would be great...
cheers
Mark
i was wondering if it was possible to pass optional vba arguments to vba
from vlisp...i've tried a few different ways (that i could think of) but
neither of them seem to work...
'vba (TestDLL.dll -> cTestClass)
public sub test (byval sMsg as string, byval sOptionalString as string = "",
optional bShowMessage as boolean = true)
if bShowMessage = true then
If not sOptionalString = "" then
msgbox sMsg & sOptionalString
else
msgbox sMsg
End if
end if
end sub
;lisp
(defun test (`sMsg `vOptionalList / `odCVariable `ReturnValue)
(setq `odCTest (vlax-create-object "TestDll.cTestClass"))
(vlax-invoke-method
`odCTest
'Test
`sMsg
(if (/= (cdr (assoc "OptionalString" `vOptionalList)) nil)
(cdr (assoc "OptionalString" `vOptionalList))
); doesn't work
;;; (if (/= (cdr (assoc "OptionalString" `vOptionalList)) nil)
;;; (strcat "sOptionalString := " (cdr (assoc "OptionalString"
`vOptionalList)))
;;; ); doesn't work
;;; (if (/= (cdr (assoc "OptionalString " `vOptionalList)) nil)
;;; (cdr (assoc "ShowMessage" `vOptionalList))
;;; ); doesn't work
;;; (if (/= (cdr (assoc "OptionalString " `vOptionalList)) nil)
;;; (strcat "bShowMessage := " (cdr (assoc "ShowMessage"
`vOptionalList)))
;;; ); doesn't work 'cause :vlax-false / true is not a string
)
(vlax-release-object `odCTest )
) ;test
;lisp calling function
(test
"This is a test"
(list
(cons "OptionalString" "blar blar blar optional")
(cons "ShowMessage" :vlax-true)
);list
)
any help would be great...
cheers
Mark