View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
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?