Problem with Macro

  • Thread starter Thread starter Shashi Bhosale
  • Start date Start date
S

Shashi Bhosale

Dim TotTemp As Double

Private Sub PSTimer1_Tick()
Chan = Application.DDEInitiate("WinWedge", "COM2")
mydata = Application.DDERequest(Chan, "FIELD(3)")
TotTemp = TotTemp + mydata
ctr = ctr + 1
End Sub


I am getting "Type Mismatch" error at TotTemp = TotTemp + mydata .

Any ideas ?
 
See what value mydata has. It probably is not a double, possibly an error
or a string.

--
Jim Rech
Excel MVP
| Dim TotTemp As Double
|
| Private Sub PSTimer1_Tick()
| Chan = Application.DDEInitiate("WinWedge", "COM2")
| mydata = Application.DDERequest(Chan, "FIELD(3)")
| TotTemp = TotTemp + mydata
| ctr = ctr + 1
| End Sub
|
|
| I am getting "Type Mismatch" error at TotTemp = TotTemp + mydata .
|
| Any ideas ?
|
|
 
Is mydata a string?

Maybe try

TotTemp = TotTemp + CDbl(mydata)

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top