G
gizmositka
I am trying to write code for a save button on a form use VBA. I have the
11.0 Object reference selected and I still get a User-defined type not
defined error.
Here is the code
'Dim dlgSaveAs As FileDialog
'Set dlgSaveAs = Application.FileDialog(msoFileDialogSelcetdItems)
' dlgSaveAs.Show
' Dim result As DialogResult
' Dim fileName As String
'dlgSaveAs.CheckFileExists = False
' If result = DialogResult.Cancel Then
' Return
' End If
' fileName = dlgSaveAs.fileName
' If (fileName = "" Or fileName = Nothing) Then
' MsgBox("Invalid File Name", vbOKCancel) As VbMsgBoxResult
' Else
'Try
'output = New FileStream(fileName, FileMode.OpenOrCreate,
FileAccess.Write)
' cmdSave.Enabled = False
' cmdEnter.Enabled = True
' Catch fileException As FileNotFoundException
'MsgBox("File does not exist!", vbOKOnly) As VbMsgBoxResult
'End Try
The error happens on the first line when I try to declare the dlgSaveAs as a
FileDialog.
Help is greatly appreciated.
11.0 Object reference selected and I still get a User-defined type not
defined error.
Here is the code
'Dim dlgSaveAs As FileDialog
'Set dlgSaveAs = Application.FileDialog(msoFileDialogSelcetdItems)
' dlgSaveAs.Show
' Dim result As DialogResult
' Dim fileName As String
'dlgSaveAs.CheckFileExists = False
' If result = DialogResult.Cancel Then
' Return
' End If
' fileName = dlgSaveAs.fileName
' If (fileName = "" Or fileName = Nothing) Then
' MsgBox("Invalid File Name", vbOKCancel) As VbMsgBoxResult
' Else
'Try
'output = New FileStream(fileName, FileMode.OpenOrCreate,
FileAccess.Write)
' cmdSave.Enabled = False
' cmdEnter.Enabled = True
' Catch fileException As FileNotFoundException
'MsgBox("File does not exist!", vbOKOnly) As VbMsgBoxResult
'End Try
The error happens on the first line when I try to declare the dlgSaveAs as a
FileDialog.
Help is greatly appreciated.