============ Dir Stream (inflated) size: 0x7bc bytes ============ Offset [recId] RecordName ------- ------- ----------- 0x0000: [0x0001] PROJECTSYSKIND SysType: 32 bit windows 0x000a: [0x0002] PROJECTLCID LCID: 0x409 ( expected 0x409 ) 0x0014: [0x0014] PROJECTLCIDINVOKE LCIDINVOKE: 0x409 ( expected 0x409 ) 0x001e: [0x0003] PROJECTCODEPAGE codepage: 1252 0x0026: [0x0004] PROJECTNAME ProjectName: VBAProject 0x0036: [0x0005] PROJECTDOCSTRING DocString: size[0x0] DocStringUnicode: size[0x0] 0x0042: [0x0006] PROJECTHELPFILEPATH HelpFile1: size[0x0] HelpFile2: size[0x0] 0x004e: [0x0007] PROJECTHELPCONTEXT HelpContext: 0x0 0x0058: [0x0008] PROJECTLIBFLAGS LIBFLAGS: 0x0 0x0062: [0x0009] PROJECTVERSION major: 1254994988 minor: 2 0x006e: [0x000c] PROJECTCONSTANTS Constants: size[0x0] Constants(Utf-16): size[0x0] 0x007a: [0x0016] REFERENCENAME ReferenceName: stdole ReferenceNameUnicode: stdole 0x0098: [0x000d] REFERENCEREGISTERED Libid: *\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\system32\stdole2.tlb#OLE Automation 0x0106: [0x0016] REFERENCENAME ReferenceName: Office ReferenceNameUnicode: Office 0x0124: [0x000d] REFERENCEREGISTERED Libid: *\G{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}#2.0#0#C:\Program Files\Common Files\Microsoft Shared\OFFICE11\MSO.DLL#Microsoft Office 10.0 Object Library 0x01c8: [0x0016] REFERENCENAME ReferenceName: MSForms ReferenceNameUnicode: MSForms 0x01e9: [0x0033] REFERENCEORIGINAL LibIdOriginal: *\G{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0#C:\windows\system32\FM20.DLL#Microsoft Forms 2.0 Object Library 0x025e: [0x002f] REFERENCECONTROL-Part1 LibIdTwiddled: *\G{00000000-0000-0000-0000-000000000000}#0.0#0## 0x029f: [0x0016] REFERENCENAME ReferenceName: MSForms ReferenceNameUnicode: MSForms 0x02c0: [0x0030] REFERENCECONTROL-Part2 LibidExtended: *\G{C6AC5687-89C8-40A7-9DB9-BFB5410D78A6}#2.0#0#C:\windows\temp\VBE\MSForms.exd#Microsoft Forms 2.0 Object Library GUID: 0xe1 0x2e 0x45 0xd 0x8f 0xe0 0x1a 0x10 0x85 0x2e 0x2 0x60 0x8c 0x4d 0xb 0xb4 cookie: 0x1 0x0356: [0x000f] PROJECTMODULES Num Modules: 9 0x035e: [0x0013] PROJECTCOOKIE ProjectCookie: 0x6802 0x0366: [0x0019] MODULENAME ModuleName: ThisWorkbook 0x0378: [0x0047] MODULENAMEUNICODE ModuleNameUnicode: ThisWorkbook 0x0396: [0x001a] MODULESTREAMNAME ModuleStreamName: ThisWorkbook ModuleStreamNameUnicode: ThisWorkbook 0x03c6: [0x001c] MODULEDOCSTRING DocString: size[0x0] DocStringUnicode: size[0x0] 0x03d2: [0x0031] MODULEOFFSET Offset: 0x335 0x03dc: [0x001e] MODULEHELPCONTEXT HelpConext: 0x0 0x03e6: [0x002c] MODULECOOKIE ModuleCookie: 0xcf67 0x03ee: [0x0022] MODULETYPE Module Type: document, class or design 0x03f4: [0x002b] PROJECTMODULETERM 0x03fa: [0x0019] MODULENAME ModuleName: Sheet1 0x0406: [0x0047] MODULENAMEUNICODE ModuleNameUnicode: Sheet1 0x0418: [0x001a] MODULESTREAMNAME ModuleStreamName: Sheet1 ModuleStreamNameUnicode: Sheet1 0x0436: [0x001c] MODULEDOCSTRING DocString: size[0x0] DocStringUnicode: size[0x0] 0x0442: [0x0031] MODULEOFFSET Offset: 0x335 0x044c: [0x001e] MODULEHELPCONTEXT HelpConext: 0x0 0x0456: [0x002c] MODULECOOKIE ModuleCookie: 0x98d6 0x045e: [0x0022] MODULETYPE Module Type: document, class or design 0x0464: [0x002b] PROJECTMODULETERM 0x046a: [0x0019] MODULENAME ModuleName: UserForm2 0x0479: [0x0047] MODULENAMEUNICODE ModuleNameUnicode: UserForm2 0x0491: [0x001a] MODULESTREAMNAME ModuleStreamName: UserForm2 ModuleStreamNameUnicode: UserForm2 0x04b8: [0x001c] MODULEDOCSTRING DocString: size[0x0] DocStringUnicode: size[0x0] 0x04c4: [0x0031] MODULEOFFSET Offset: 0x938 0x04ce: [0x001e] MODULEHELPCONTEXT HelpConext: 0x0 0x04d8: [0x002c] MODULECOOKIE ModuleCookie: 0x9ec0 0x04e0: [0x0022] MODULETYPE Module Type: document, class or design 0x04e6: [0x0028] MODULEPRIVATE 0x04ec: [0x002b] PROJECTMODULETERM 0x04f2: [0x0019] MODULENAME ModuleName: XYCoord 0x04ff: [0x0047] MODULENAMEUNICODE ModuleNameUnicode: XYCoord 0x0513: [0x001a] MODULESTREAMNAME ModuleStreamName: XYCoord ModuleStreamNameUnicode: XYCoord 0x0534: [0x001c] MODULEDOCSTRING DocString: size[0x0] DocStringUnicode: size[0x0] 0x0540: [0x0031] MODULEOFFSET Offset: 0xe06 0x054a: [0x001e] MODULEHELPCONTEXT HelpConext: 0x0 0x0554: [0x002c] MODULECOOKIE ModuleCookie: 0x6bf1 0x055c: [0x0022] MODULETYPE Module Type: document, class or design 0x0562: [0x0028] MODULEPRIVATE 0x0568: [0x002b] PROJECTMODULETERM 0x056e: [0x0019] MODULENAME ModuleName: UserForm1 0x057d: [0x0047] MODULENAMEUNICODE ModuleNameUnicode: UserForm1 0x0595: [0x001a] MODULESTREAMNAME ModuleStreamName: UserForm1 ModuleStreamNameUnicode: UserForm1 0x05bc: [0x001c] MODULEDOCSTRING DocString: size[0x0] DocStringUnicode: size[0x0] 0x05c8: [0x0031] MODULEOFFSET Offset: 0x3621 0x05d2: [0x001e] MODULEHELPCONTEXT HelpConext: 0x0 0x05dc: [0x002c] MODULECOOKIE ModuleCookie: 0xae9c 0x05e4: [0x0022] MODULETYPE Module Type: document, class or design 0x05ea: [0x0028] MODULEPRIVATE 0x05f0: [0x002b] PROJECTMODULETERM 0x05f6: [0x0019] MODULENAME ModuleName: Module1 0x0603: [0x0047] MODULENAMEUNICODE ModuleNameUnicode: Module1 0x0617: [0x001a] MODULESTREAMNAME ModuleStreamName: Module1 ModuleStreamNameUnicode: Module1 0x0638: [0x001c] MODULEDOCSTRING DocString: size[0x0] DocStringUnicode: size[0x0] 0x0644: [0x0031] MODULEOFFSET Offset: 0x2e8a 0x064e: [0x001e] MODULEHELPCONTEXT HelpConext: 0x0 0x0658: [0x002c] MODULECOOKIE ModuleCookie: 0x4fe5 0x0660: [0x0021] MODULETYPE Module Type: procedure 0x0666: [0x002b] PROJECTMODULETERM 0x066c: [0x0019] MODULENAME ModuleName: Sheet3 0x0678: [0x0047] MODULENAMEUNICODE ModuleNameUnicode: Sheet3 0x068a: [0x001a] MODULESTREAMNAME ModuleStreamName: Sheet3 ModuleStreamNameUnicode: Sheet3 0x06a8: [0x001c] MODULEDOCSTRING DocString: size[0x0] DocStringUnicode: size[0x0] 0x06b4: [0x0031] MODULEOFFSET Offset: 0x3da 0x06be: [0x001e] MODULEHELPCONTEXT HelpConext: 0x0 0x06c8: [0x002c] MODULECOOKIE ModuleCookie: 0xfa50 0x06d0: [0x0022] MODULETYPE Module Type: document, class or design 0x06d6: [0x002b] PROJECTMODULETERM 0x06dc: [0x0019] MODULENAME ModuleName: Help 0x06e6: [0x0047] MODULENAMEUNICODE ModuleNameUnicode: Help 0x06f4: [0x001a] MODULESTREAMNAME ModuleStreamName: Help ModuleStreamNameUnicode: Help 0x070c: [0x001c] MODULEDOCSTRING DocString: size[0x0] DocStringUnicode: size[0x0] 0x0718: [0x0031] MODULEOFFSET Offset: 0xde1 0x0722: [0x001e] MODULEHELPCONTEXT HelpConext: 0x0 0x072c: [0x002c] MODULECOOKIE ModuleCookie: 0x9129 0x0734: [0x0022] MODULETYPE Module Type: document, class or design 0x073a: [0x0028] MODULEPRIVATE 0x0740: [0x002b] PROJECTMODULETERM 0x0746: [0x0019] MODULENAME ModuleName: About 0x0751: [0x0047] MODULENAMEUNICODE ModuleNameUnicode: About 0x0761: [0x001a] MODULESTREAMNAME ModuleStreamName: About ModuleStreamNameUnicode: About 0x077c: [0x001c] MODULEDOCSTRING DocString: size[0x0] DocStringUnicode: size[0x0] 0x0788: [0x0031] MODULEOFFSET Offset: 0x9c1 0x0792: [0x001e] MODULEHELPCONTEXT HelpConext: 0x0 0x079c: [0x002c] MODULECOOKIE ModuleCookie: 0x9f69 0x07a4: [0x0022] MODULETYPE Module Type: document, class or design 0x07aa: [0x0028] MODULEPRIVATE 0x07b0: [0x002b] PROJECTMODULETERM 0x07b6: [0x0010] DIRTERMINATOR ============ PROJECTwm Stream size: 0xe0 bytes)============ 000: 54 68 69 73 57 6F 72 6B 62 6F 6F 6B 00 54 00 68 ThisWorkbook.T.h 016: 00 69 00 73 00 57 00 6F 00 72 00 6B 00 62 00 6F .i.s.W.o.r.k.b.o 032: 00 6F 00 6B 00 00 00 53 68 65 65 74 31 00 53 00 .o.k...Sheet1.S. 048: 68 00 65 00 65 00 74 00 31 00 00 00 55 73 65 72 h.e.e.t.1...User 064: 46 6F 72 6D 31 00 55 00 73 00 65 00 72 00 46 00 Form1.U.s.e.r.F. 080: 6F 00 72 00 6D 00 31 00 00 00 4D 6F 64 75 6C 65 o.r.m.1...Module 096: 31 00 4D 00 6F 00 64 00 75 00 6C 00 65 00 31 00 1.M.o.d.u.l.e.1. 112: 00 00 58 59 43 6F 6F 72 64 00 58 00 59 00 43 00 ..XYCoord.X.Y.C. 128: 6F 00 6F 00 72 00 64 00 00 00 55 73 65 72 46 6F o.o.r.d...UserFo 144: 72 6D 32 00 55 00 73 00 65 00 72 00 46 00 6F 00 rm2.U.s.e.r.F.o. 160: 72 00 6D 00 32 00 00 00 53 68 65 65 74 33 00 53 r.m.2...Sheet3.S 176: 00 68 00 65 00 65 00 74 00 33 00 00 00 48 65 6C .h.e.e.t.3...Hel 192: 70 00 48 00 65 00 6C 00 70 00 00 00 41 62 6F 75 p.H.e.l.p...Abou 208: 74 00 41 00 62 00 6F 00 75 00 74 00 00 00 00 00 t.A.b.o.u.t..... ============ PROJECT Stream size: 0x34a bytes)============ ID="{EF416B66-6FF7-4771-8749-E3B2360B0ED6}" Document=ThisWorkbook/&H00000000 Document=Sheet1/&H00000000 Package={AC9F2F90-E877-11CE-9F68-00AA00574A4F} BaseClass=UserForm1 Module=Module1 Class=XYCoord BaseClass=UserForm2 Document=Sheet3/&H00000000 BaseClass=Help BaseClass=About Name="VBAProject" HelpContextID="0" VersionCompatible32="393222000" CMG="80825E6462646264626462" DPB="0002DEE1DFE1DFE1" GC="80825E615F615F9E" [Host Extender Info] &H00000001={3832D640-CF90-11CF-8E43-00A0C911005A};VBE;&H00000000 [Workspace] ThisWorkbook=0, 0, 0, 0, C Sheet1=0, 0, 0, 0, C UserForm1=0, 0, 0, 0, C, 44, 44, 925, 601, C Module1=66, 66, 684, 502, XYCoord=0, 0, 0, 0, C UserForm2=0, 0, 0, 0, C, 22, 22, 903, 579, C Sheet3=0, 0, 0, 0, C Help=0, 0, 0, 0, C, 88, 88, 706, 524, C About=0, 0, 0, 0, C, 110, 110, 728, 546, C ============ ThisWorkbook Stream (inflated) size: 0x3e9 bytes offset: 0x335 ============ Attribute VB_Name = "ThisWorkbook" Attribute VB_Base = "0{00020819-0000-0000-C000-000000000046}" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = True Attribute VB_TemplateDerived = False Attribute VB_Customizable = True ============ Sheet1 Stream (inflated) size: 0x3e1 bytes offset: 0x335 ============ Attribute VB_Name = "Sheet1" Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = True Attribute VB_TemplateDerived = False Attribute VB_Customizable = True ============ UserForm2 Stream (inflated) size: 0xb68 bytes offset: 0x938 ============ Attribute VB_Name = "UserForm2" Attribute VB_Base = "0{4EFCDEB9-C4FD-43A7-956D-BBD1928DC48E}{03214C05-B2DA-4D33-8C08-42F70A8110AF}" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Attribute VB_TemplateDerived = False Attribute VB_Customizable = False ' in anticipation of people sneaking many ' looks at the completed puzzle we ' hide the userform rather than unload the ' object. This will make it faster to raise the ' userform. The userform object is unloaded when the ' main puzzle userform is dismissed Private Sub CommandButton1_Click() Me.Hide End Sub Private Sub UserForm_Initialize() Me.Caption = APPNAME + " ( Cheaty Peek! )" End Sub ============ XYCoord Stream (inflated) size: 0xf63 bytes offset: 0xe06 ============ Attribute VB_Name = "XYCoord" Attribute VB_Base = "0{FCFB3D2A-A0FA-1068-A738-08002B3371B5}" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = False Attribute VB_Exposed = False Attribute VB_TemplateDerived = False Attribute VB_Customizable = False Private TileObj As Object Public Property Get XPos() As Single XPos = TileObj.Top End Property Public Property Let XPos(val As Single) TileObj.Top = val End Property Public Property Get YPos() As Single YPos = TileObj.Left End Property Public Property Let YPos(val As Single) TileObj.Left = val End Property Public Property Get Tile() As Object Set Tile = TileObj End Property Public Property Let Tile(val As Object) Set TileObj = val End Property ============ UserForm1 Stream (inflated) size: 0x3966 bytes offset: 0x3621 ============ Attribute VB_Name = "UserForm1" Attribute VB_Base = "0{7BE3CA81-F3AB-43DC-8584-E0AA19B0CDF1}{B3B6BF8A-ACF6-41BD-A9ED-1ADA8076C343}" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Attribute VB_TemplateDerived = False Attribute VB_Customizable = False Private Sub CancelButton_Click() Unload Me End Sub Private Sub CommandButton1_Click() UserForm2.Show End Sub Private Sub CommandButton2_Click() shuffle End Sub Private Sub CommandButton3_Click() About.Show End Sub Private Sub Image1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) processTileClick Image1.Top, Image1.Left End Sub Private Sub Image2_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) processTileClick Image2.Top, Image2.Left End Sub Private Sub Image3_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) processTileClick Image3.Top, Image3.Left End Sub Private Sub Image4_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) processTileClick Image4.Top, Image4.Left End Sub Private Sub Image5_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) processTileClick Image5.Top, Image5.Left End Sub Private Sub Image6_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) processTileClick Image6.Top, Image6.Left End Sub Private Sub Image7_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) processTileClick Image7.Top, Image7.Left End Sub Private Sub Image8_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) processTileClick Image8.Top, Image8.Left End Sub Private Sub Image9_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) processTileClick Image9.Top, Image9.Left End Sub Private Sub Image10_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) processTileClick Image10.Top, Image10.Left End Sub Private Sub Image11_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) processTileClick Image11.Top, Image11.Left End Sub Private Sub Image12_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) processTileClick Image12.Top, Image12.Left End Sub Private Sub Image13_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) processTileClick Image13.Top, Image13.Left End Sub Private Sub Image14_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) processTileClick Image14.Top, Image14.Left End Sub Private Sub Image15_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) processTileClick Image15.Top, Image15.Left End Sub Private Sub Image16_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) processTileClick Image16.Top, Image16.Left End Sub Private Sub UserForm_Initialize() Me.Caption = APPNAME initData End Sub Private Sub UserForm_Terminate() Unload UserForm2 End Sub ============ Module1 Stream (inflated) size: 0x3945 bytes offset: 0x2e8a ============ Attribute VB_Name = "Module1" Option Explicit Public Const APPNAME As String = "Suse Puzzler" Public currentPositions(1 To 16) As Variant Public initialNames(1 To 16) As String Public moves As Integer Public freeTilePos As Integer Public Rows As Integer Public Cols As Integer ' hmmmm, I'm a little uncertain whether just swapping tiles ' will result in a solveable puzzle so I simulate someone ' manically clicking the puzzle instead ( that at least ' guarantees it will be solveable ) Sub shuffle() Randomize Dim clickedPos As Integer Dim i As Integer ' we could switch a number here for difficulty ' 15 for easy, 30 for medium, 60 for hard ( or whatever ) For i = 1 To 15 Dim upperbound As Integer Dim lowerbound As Integer If freeTilePos - 4 < 1 Then lowerbound = 1 Else lowerbound = freeTilePos - 4 End If If freeTilePos + 4 > 16 Then upperbound = 16 Else upperbound = freeTilePos + 4 End If clickedPos = Int((upperbound - lowerbound + 1) * Rnd + lowerbound) 'simulate someone clicking ( moving ) 'the tiles 'i' times. 'check if this is a valid click, if not don't 'count it If canMoveTile(clickedPos) Then moveTile clickedPos Else ' reset counter i = i - 1 End If Next i End Sub ' detect if tile clicked can be moved Function canMoveTile(clickedPos As Integer) As Boolean Dim bMove As Boolean bMove = False ' if on the same line adjacent tiles are valid for swapping If ((clickedPos - 1) \ 4) = ((freeTilePos - 1) \ 4) Then If (clickedPos - 1) = freeTilePos Or (clickedPos + 1) = freeTilePos Then bMove = True End If Else ' free and clicked on different lines means one needs to be above the other If (clickedPos + 4) = freeTilePos Or (clickedPos - 4) = freeTilePos Then bMove = True End If End If canMoveTile = bMove End Function ' detect if the puzzle is finished Function isSolved() As Boolean Dim bIsSolved As Boolean bIsSolved = True Dim i As Integer For i = LBound(currentPositions) To UBound(currentPositions) If initialNames(i) <> currentPositions(i).Tile.Name Then bIsSolved = False Exit For End If Next i isSolved = bIsSolved End Function ' would be better to use a user defined type instead of a class ' module ' But Openoffice has some problems with user defined types ' o can't currently handle scope declarations ( e.g. public private etc. ) ' o won't allow you do define an array of user type ' otoh VBA ' o doesn't allow variant array to use user defined types ' easily ( I haven't found how to get it to accept it ) ' but openoffice does this easily Sub insertPosition(index As Integer, aControl As Variant, Optional bInit As Boolean = False) Dim xy As New XYCoord xy.Tile = aControl Set currentPositions(index) = xy If bInit Then initialNames(index) = aControl.Name End If End Sub ' Set up the initial ( i.e. solved state of the puzzel ) Sub initData() Rows = 4 Cols = 4 moves = 0 insertPosition 1, UserForm1.Image1, True insertPosition 2, UserForm1.Image2, True insertPosition 3, UserForm1.Image3, True insertPosition 4, UserForm1.Image4, True insertPosition 5, UserForm1.Image5, True insertPosition 6, UserForm1.Image6, True insertPosition 7, UserForm1.Image7, True insertPosition 8, UserForm1.Image8, True insertPosition 9, UserForm1.Image9, True insertPosition 10, UserForm1.Image10, True insertPosition 11, UserForm1.Image11, True insertPosition 12, UserForm1.Image12, True insertPosition 13, UserForm1.Image13, True insertPosition 14, UserForm1.Image14, True insertPosition 15, UserForm1.Image15, True insertPosition 16, UserForm1.Image16, True freeTilePos = 16 ' mark the blank tile End Sub ' handle a click on a tile, if it's a valid tile, swap ' the free tile with the clicked one Function processTileClick(X As Single, Y As Single) Dim clickedPos As Integer clickedPos = findIndex(X, Y) ' is the tile clicked immediately next to the ' blank tile ? If canMoveTile(clickedPos) Then ' move the tile moveTile clickedPos moves = moves + 1 ' check is puzzle solved If isSolved Then MsgBox "Congratulations you solved the puzzle in " & moves & " moves" moves = 0 ' reset End If End If End Function ' swaps source with freeTile Sub moveTile(sourceIndex As Integer) Dim XPos As Single Dim YPos As Single Dim tmpObj As XYCoord 'save sourcePos XPos = currentPositions(sourceIndex).XPos YPos = currentPositions(sourceIndex).YPos ' swap tiles currentPositions(sourceIndex).XPos = currentPositions(freeTilePos).XPos currentPositions(sourceIndex).YPos = currentPositions(freeTilePos).YPos currentPositions(freeTilePos).XPos = XPos currentPositions(freeTilePos).YPos = YPos 'swap array positions Set tmpObj = currentPositions(sourceIndex) Set currentPositions(sourceIndex) = currentPositions(freeTilePos) Set currentPositions(freeTilePos) = tmpObj 'set new free tile index freeTilePos = sourceIndex End Sub ' start the puzzle Sub launch() UserForm1.Show End Sub ' find the index of the tile with give coordinates Function findIndex(X As Single, Y As Single) As Integer Dim i As Integer For i = LBound(currentPositions) To UBound(currentPositions) If X = currentPositions(i).XPos And Y = currentPositions(i).YPos Then findIndex = i Exit For End If Next i End Function ============ Sheet3 Stream (inflated) size: 0x486 bytes offset: 0x3da ============ Attribute VB_Name = "Sheet3" Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = True Attribute VB_TemplateDerived = False Attribute VB_Customizable = True ============ Help Stream (inflated) size: 0x1066 bytes offset: 0xde1 ============ Attribute VB_Name = "Help" Attribute VB_Base = "0{0E2F7240-97DE-4AF4-86DC-50DC97697EE6}{4A9F31FA-EAF1-4F87-B04E-7033E5D23C27}" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Attribute VB_TemplateDerived = False Attribute VB_Customizable = False Option Explicit Private Sub CancelButton_Click() Unload Me End Sub Private Sub SpinButton1_Change() Dim HelpTopic As Integer HelpTopic = SpinButton1.Value LabelTopic.Caption = Sheets("HelpSheet").Cells(HelpTopic, 1) LabelText.Caption = Sheets("HelpSheet").Cells(HelpTopic, 2) Me.Caption = APPNAME & " (Help Topic " & HelpTopic & " of " & SpinButton1.Max & ")" End Sub Private Sub UserForm_Initialize() Me.Caption = APPNAME With SpinButton1 .Max = Application.WorksheetFunction.CountA(Sheets("HelpSheet").Range("A:A")) .Min = 1 .Value = 1 End With SpinButton1_Change ' we don't seem to get this in intialisation on openoffice End Sub ============ About Stream (inflated) size: 0xb3a bytes offset: 0x9c1 ============ Attribute VB_Name = "About" Attribute VB_Base = "0{1E0106DE-38B2-4A9D-90CF-B466193B35BE}{CA6E7D7F-ABE4-4920-BF37-4437E115C277}" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Attribute VB_TemplateDerived = False Attribute VB_Customizable = False Private Sub CommandButton1_Click() Unload Me End Sub Private Sub CommandButton2_Click() Help.Show End Sub Private Sub UserForm_Click() End Sub Private Sub UserForm_Initialize() Me.Caption = APPNAME + " ( About )" End Sub