Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default parameter problem

hi all,

having a bit of trouble with a function

MsgBox DepositIntoInventory(ManageInventory.DepositLot,
ManageInventory.DepositCases, ManageInventory.DepositMonth), vbOKOnly, "Alert"

is the call and i'm getting a type mismatch error

Public Function DepositIntoInventory(lotNum As ComboBox, numCases As
TextBox, monthName As ComboBox) As String

DepositIntoInventory = "Deposit of " & numCases.Caption & " cases of lot
" & lotNum.Value & " in " & monthName.Value & " was successful."

End Function

all the types are correct, DepositLot is a combobox, DepositCases is a
TextBox, DepositMonth is a ComboBox

if i change the types to string in the definition of the function, and
remove the qualifiers - then it works ok.

can anyone help explain why?

tia

J
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default parameter problem


Change your argument type declarations to MSForms.ComboBox and
MSForms.TextBox. Without the MSForms prefix VBA thinks you are referring to
the Excel drawing objects of those names.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"Gixxer_J_97" wrote in message
...
hi all,

having a bit of trouble with a function

MsgBox DepositIntoInventory(ManageInventory.DepositLot,
ManageInventory.DepositCases, ManageInventory.DepositMonth), vbOKOnly,
"Alert"

is the call and i'm getting a type mismatch error

Public Function DepositIntoInventory(lotNum As ComboBox, numCases As
TextBox, monthName As ComboBox) As String

DepositIntoInventory = "Deposit of " & numCases.Caption & " cases of
lot
" & lotNum.Value & " in " & monthName.Value & " was successful."

End Function

all the types are correct, DepositLot is a combobox, DepositCases is a
TextBox, DepositMonth is a ComboBox

if i change the types to string in the definition of the function, and
remove the qualifiers - then it works ok.

can anyone help explain why?

tia

J



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default parameter problem

What is ManageInventory? And also, why are you using numcases.caption and
not numcases.value?

"Gixxer_J_97" wrote:

hi all,

having a bit of trouble with a function

MsgBox DepositIntoInventory(ManageInventory.DepositLot,
ManageInventory.DepositCases, ManageInventory.DepositMonth), vbOKOnly, "Alert"

is the call and i'm getting a type mismatch error

Public Function DepositIntoInventory(lotNum As ComboBox, numCases As
TextBox, monthName As ComboBox) As String

DepositIntoInventory = "Deposit of " & numCases.Caption & " cases of lot
" & lotNum.Value & " in " & monthName.Value & " was successful."

End Function

all the types are correct, DepositLot is a combobox, DepositCases is a
TextBox, DepositMonth is a ComboBox

if i change the types to string in the definition of the function, and
remove the qualifiers - then it works ok.

can anyone help explain why?

tia

J

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default parameter problem

Thanks Rob!

ManageInventory is my userform - numcases.caption was a typo on my part.

"K Dales" wrote:

What is ManageInventory? And also, why are you using numcases.caption and
not numcases.value?

"Gixxer_J_97" wrote:

hi all,

having a bit of trouble with a function

MsgBox DepositIntoInventory(ManageInventory.DepositLot,
ManageInventory.DepositCases, ManageInventory.DepositMonth), vbOKOnly, "Alert"

is the call and i'm getting a type mismatch error

Public Function DepositIntoInventory(lotNum As ComboBox, numCases As
TextBox, monthName As ComboBox) As String

DepositIntoInventory = "Deposit of " & numCases.Caption & " cases of lot
" & lotNum.Value & " in " & monthName.Value & " was successful."

End Function

all the types are correct, DepositLot is a combobox, DepositCases is a
TextBox, DepositMonth is a ComboBox

if i change the types to string in the definition of the function, and
remove the qualifiers - then it works ok.

can anyone help explain why?

tia

J

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to choose if I use a parameter or not in a parameter query Arnaud Excel Discussion (Misc queries) 0 March 8th 07 01:19 PM
TypeLib Information Problem? Pass a Function's parameter names as string for parsing? Ali G Excel Programming 1 December 3rd 04 07:02 PM
Problem with the PrToFileName parameter when using the Printout method on a worksheet Prasad Vanka Excel Programming 6 May 14th 04 10:56 AM
Problem with ADO with Parameter Object Tod Excel Programming 1 May 7th 04 11:03 AM
Problem with named range as VBA macro parameter Ken[_11_] Excel Programming 4 March 5th 04 02:16 PM


All times are GMT +1. The time now is 12:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"