run-time error 13: Type mismatch?

M

Marko Enula

Hello!

I have on excel file what worked just fine for quite long time, but now
suddenly when i open it first it will give me such a message:"this
application is about to initialize ActiveX controls that might be unsafe. If
you trust the source of this file, select ok and the controls will be
initialized using your current workspace settings" i press ok there. And then
I am receiving a run time error 13 type mismatch I press debug and this line
with -> is highlighted and if i put ' this before the line it takes next line
yellow :
Public Sub InitSheets()
Set shtCreate = Application.Sheets(1)
Set shtSwitch = Application.Sheets(2)
Set shtMeas = Application.Sheets(3)
Set shtAlarm = Application.Sheets(4)
Set shtTrafo = Application.Sheets(5)
-> Set shtBayLR = Application.Sheets(6)
Set shtStationLR = Application.Sheets(7)
Set shtLineInd = Application.Sheets(8)
Set shtGenerator = Application.Sheets(9)
Set shtAR = Application.Sheets(10)
Set shtTrip = Application.Sheets(11)

Set shtSymbols = Application.Sheets(12)
Set shtMappings = Application.Sheets(13)
Set shtDataSrc = Application.Sheets(14)
Set shtDefaults = Application.Sheets(15)
End Sub


First I thought that would be some regional settings problem but it doesn't
seem to be.

Thanks,
 
J

JLatham

I think some more investigation into the ActiveX control is probably needed.
Do you know what it might be? Couild be a 'link' control to gather
information from the internet, or some special controls that look like
buttons - many possibilities.

As for why you're getting the type mismatch, it may be that shtBayLR is
defined as another type somewhere else in code.

As for putting the ' in front of the line and next one turning yellow, is
that putting the ' at the start of a line turns it into a comment and the
debugger is just moving to the next line that can be executed as a code
statement and highlighting it in yellow.
 
P

Pete_UK

Perhaps the name of your 6th sheet has a space in it - if so, replace
the space with underscore.

Hope this helps.

Pete
 

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

Top