Question: I am migrating a lot of old presentations to a new design using VBA. I have created the new file from a template, copied each slide across and applied the correct custom layout that I need to each one. Once done, I am left with a load of the old custom layouts that are not used, and want to delete them all. The new design uses 50 custom layouts. Is there a way to find the ones after that 50 and delete them? Or delete all layouts after a layout of a specific name?
Here is the code I'm using at the moment. This doesn't remove them all, for some reason. Any help is welcome.

```
    Dim colUsedLayouts As New Collection

For Each sld In NewPres.Slides
    colUsedLayouts.Add sld.CustomLayout
Next

Dim UsedLayout As CustomLayout
Dim LayoutHasBeenUsed As Boolean
Dim EndPointLogoFound As Boolean
For Each lay In NewPres.Designs(1).SlideMaster.CustomLayouts

    If Trim(LCase(lay.name)) = "blank no logo" Then 'Used the else statement so it doesn't delete the Blank No logo layout
        EndPointLogoFound = True
    Else
        If EndPointLogoFound Then
            LayoutHasBeenUsed = False

            For Each UsedLayout In colUsedLayouts
                If UsedLayout Is lay Then
                    LayoutHasBeenUsed = True
                End If
            Next

            If Not LayoutHasBeenUsed Then
                lay.Delete
            End If
        End If
    End If
Next

```

Answer: 
You could utilize vue's [`defineExpose`](https://vuejs.org/api/sfc-script-setup.html#defineexpose) method and then add a `ref` for your `MainContent` component and access it through that.

```
<!-- MAIN COMPONENT -->
<template>
    <PageWrap>
        <template v-slot:content>
            <MainContent ref="mainContentComponent">
                <template v-slot:content />
            </MainContent>
        </template>
    </PageWrap>
</template>

<script setup>
    const mainContentComponent = ref()

    // Now you can do:
    mainContentComponent.value.mainContentRef.value
</script>

<!-- MAIN CONTENT COMPONENT -->
<template>
    <div id="main-content" ref="mainContentRef">
        <slot name='content'></slot>
    </div>
</template>

<script setup>
    import { ref } from 'vue'

    const mainContentRef = ref(0)

    defineExpose({
        mainContentRef
    })
</script>

```

See Also: <https://vuejs.org/guide/essentials/template-refs.html#ref-on-component>

Let me know if you have any questions or it doesn't work, happy to help!
you can try:

```js
<!-- MAIN CONTENT COMPONENT -->
<template>
    <div id="main-content" ref='mainContentRef'>
        <slot name='content'></slot>
    </div>
</template>

<script setup>

    import { defineProps, ref } from 'vue';

    const mainContentRef = ref(null);

     // Now you can do:
     mainContentRef.value.children[0]

</script>

```