User-defined type not defined

Anonymous
2023-02-14T01:08:08+00:00

Hi all,

I went into the VBA and this is the line that failed "Dim xlApp As Excel.Application"

There are 4 more Dim statements referring to Excel, so I figure these will probably fail as well:

   Dim xlBook As Excel.Workbook
   Dim xlSheet As Excel.Worksheet   
   Dim rowCounter As Long

Dim emailBody As String

I'm trying to export the contents (form based) out into excel sheet, so quick help is appreciated in advance. Besides, I'm not able to click on the References under Tools tab.

Below is my variables declaration.

Sub ExportEmailsToExcel()

'Declare variables

Dim outlookApp As Outlook.Application

Dim outlookNamespace As NameSpace

Dim folder As MAPIFolder

Dim email As Variant

Dim xlApp As Excel.Application

Dim xlWorkbook As Excel.Workbook

Dim xlWorksheet As Excel.Worksheet

Dim rowCounter As Long

Dim emailBody As String

'Get the outlook application object

Set outlookApp = New Outlook.Application

Thanks,

Nicholas Ryan

Outlook | Windows | Classic Outlook for Windows | For home

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-02-14T03:44:38+00:00

    Dear Nicholas Ryan Wong Jun Jie,

    Good day!

    Thank you for posting to Microsoft Community. We are glad to assist.
    We carefully checked your post and learned that your query is about User-defined type not defined. After consulting with the relevant team, since concern is related with VBA and for that we have separate dedicated team who have special expertise in VBA related all queries and have required tools and resource to check VBA related issue. Please forgive me, our forum is focused on Microsoft 365 for business, the knowledge of the VBA is relatively shallow, it is recommended to kindly post your query on Questions - Microsoft Q&A site, this is our dedicated support for VBA related issues, with more experience and professional insights. Our related expert support team will further work with you and further assist you.

    Your understanding and cooperation are greatly appreciated.
    wish you all the best.

    Sincerely,

    Winter| Microsoft Community Moderator

    0 comments No comments