Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VB error, runtime error 13 (type mismatch)


I don't know why the following code keeps coming back as a runtime error
13, type mismatch; I have checked the code several times and I can't
find the problem - can anyone help me?

Option Explicit
Sub cmdclick()

Dim app As Application
Dim wkbk As Workbook
Dim shtctrl As Worksheet

Dim StarName As String

Set wkbk = ThisWorkbook
Set app = wkbk.Application
app.ScreenUpdating = False
Set wkbk = ThisWorkbook
Set shtctrl = wkbk.Worksheets("Control")

StarName = wkbk.Path & "\" & "STAR Week No " & _
wkbk.Names("WeekNo").RefersToRange.Value & " " & _
FORMAT(WKBK.NAMES(\"CONTROLDATE\").REFERSTORANGE.V ALUE, \"MMM DD YY\")

MakeSTAR StarName

MsgBox "Finished"

End Sub


--
hindlehey
------------------------------------------------------------------------
hindlehey's Profile: http://www.excelforum.com/member.php...o&userid=28617
View this thread: http://www.excelforum.com/showthread...hreadid=482788

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default VB error, runtime error 13 (type mismatch)

Hi
The line
Set app = wkbk.Application

is your problem. You can have Application.wkbk, but not the other way
round. You also have _ when you need (space)_. I didn't check the two
lines after StarName is defined.

Try this:
Option Explicit
Sub cmdclick()


Dim wkbk As Workbook
Dim shtctrl As Worksheet

Dim StarName As String
Application.ScreenUpdating = False

Set wkbk = ThisWorkbook
Set shtctrl = wkbk.Worksheets("Control")

StarName = wkbk.Path & "\" & "STAR Week No " & _
wkbk.Names("WeekNo").RefersToRange.Value & " " & _
FORMAT(WKBK.NAMES(\"CONTROLDATE\").REFERSTORANGE.V ALUE, \"MMM DD YY\")

MakeSTAR StarName

MsgBox "Finished"

End Sub

regards
Paul
hindlehey wrote:
I don't know why the following code keeps coming back as a runtime error
13, type mismatch; I have checked the code several times and I can't
find the problem - can anyone help me?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VB error, runtime error 13 (type mismatch)


Thanks so much, this did help!


--
hindlehey
------------------------------------------------------------------------
hindlehey's Profile: http://www.excelforum.com/member.php...o&userid=28617
View this thread: http://www.excelforum.com/showthread...hreadid=482788

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
xpath error? Runtime Error 13 type mismatch Steve M[_2_] Excel Discussion (Misc queries) 0 January 17th 08 01:16 AM
xpath error? Runtime Error 13 type mismatch SteveM Excel Discussion (Misc queries) 1 December 4th 07 09:16 AM
Runtime Error '13': Type mismatch Linking to specific cells in pivot table Excel Programming 2 May 18th 05 07:34 PM
Runtime error 13 type mismatch ? JoeH[_15_] Excel Programming 1 September 25th 04 06:00 PM
Runtime error 13 type mismatch ? JoeH[_14_] Excel Programming 1 September 25th 04 04:57 PM


All times are GMT +1. The time now is 09:19 PM.

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

About Us

"It's about Microsoft Excel"