LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default User-defined type not defined

You have a bunch of problems...

What is this line for.
Private Sub Workbook_Open()

You defined fig as an array so you can not just assign to it
..fig = ("gar2")

Coloca_Pos is a sub so the = sign makes no sense
Coloca_Pos(jogo, 6, 6) = 1

You have 2 end subs in one procedure.
End Sub ' Coloca_Pos
End Sub

Probably not a problem but you defined
LastRow As Integer
but integer maxed out at 32k. There are 65k rows.
--
HTH...

Jim Thomlinson


"shapper" wrote:

Hello,

I have a Worksheet with 36 images all them having a name.

I also have a button that run clicked runs the Macro "Play". And I
have the following code:

Private Sub Workbook_Open()

Option Explicit

Type TpJogo
fig(1 To 6, 1 To 6) As String
LastRow As Integer
LastCol As Integer
Score As Integer
End Type ' TpJogo

Public jogo As TpJogo

Sub Play()

With jogo
.fig = ("gar2")
.LastRow = 8
.LastCol = 7
.Score = 0
End With

Coloca_Pos(jogo, 6, 6) = 1

End Sub

Sub Coloca_Pos(ByRef jogo As TpJogo, ByVal r As Integer, ByVal c As
Integer)

Dim hc As Single, hf As Single, wc As Single, wf As Single
Dim nf As String
On Error GoTo fim
With Range("tabuleiro")
hc = .Cells(r, c).Height
wc = .Cells(r, c).Width
nf = jogo.fig(r, c)
hf = ActiveSheet.Shapes(nf).Height
wf = ActiveSheet.Shapes(nf).Width
ActiveSheet.Shapes(nf).Top = .Cells(r, c).Top + (hc - hf) / 2
ActiveSheet.Shapes(nf).Left = .Cells(r, c).Left + (wc - wf) / 2
End With
fim:

End Sub ' Coloca_Pos

End Sub

When I click the I get the following error:
User-defined type not defined.

What am I doing wrong?

Thanks,
Miguel

 
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
User Defined Type not Defined error Chip Pearson Excel Programming 0 December 7th 06 07:09 PM
"User-defined type not defined" message in Excel RW1946 Excel Discussion (Misc queries) 0 August 31st 05 12:14 PM
Workspace faux user-defined type not defined Chris S[_2_] Excel Programming 3 November 11th 04 05:51 PM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM
Word.Document - user defined type not defined jowatkins[_7_] Excel Programming 0 January 20th 04 08:46 AM


All times are GMT +1. The time now is 01:51 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"