ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unable to Compile a Macro (https://www.excelbanter.com/excel-programming/428910-unable-compile-macro.html)

Bobby

Unable to Compile a Macro
 
Hi ,
I am trying to compile the following code.But iam getting the following error:
Error
*****
User Defined Type not define :
Public fso As New Scripting.FileSystemObject
*****
Code
*****
Option Explicit

Public fso As New Scripting.FileSystemObject

Public vertView As Boolean


Public Sub Auto_Open()
On Error GoTo ErrorHandler

Dim newMenu As Menu, menuName As String


menuName = Application.MenuBars(xlWorksheet).Menus("MainMenu" ).Caption

Exit Sub
ErrorHandler:
If Err.Number = 1004 Then
Set newMenu =
Application.MenuBars(xlWorksheet).Menus.Add("&Main Menu", _
Application.MenuBars(xlWorksheet).Menus.Count)

newMenu.MenuItems.Add "E&xport Data File ...", "ExportToFile"
End If
End Sub

Jacob Skaria

Unable to Compile a Macro
 
From VBEToolsReference Available references

select (or check ) 'Microsoft Scripting Runtime'

--
If this post helps click Yes
---------------
Jacob Skaria


"Bobby" wrote:

Hi ,
I am trying to compile the following code.But iam getting the following error:
Error
*****
User Defined Type not define :
Public fso As New Scripting.FileSystemObject
*****
Code
*****
Option Explicit

Public fso As New Scripting.FileSystemObject

Public vertView As Boolean


Public Sub Auto_Open()
On Error GoTo ErrorHandler

Dim newMenu As Menu, menuName As String


menuName = Application.MenuBars(xlWorksheet).Menus("MainMenu" ).Caption

Exit Sub
ErrorHandler:
If Err.Number = 1004 Then
Set newMenu =
Application.MenuBars(xlWorksheet).Menus.Add("&Main Menu", _
Application.MenuBars(xlWorksheet).Menus.Count)

newMenu.MenuItems.Add "E&xport Data File ...", "ExportToFile"
End If
End Sub



All times are GMT +1. The time now is 11:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com