Buenas!
Estou usando este código, em conjunto com outros, para converter um arquivo .snp em .pdf.
O que está me incomodando é que sempre que compilo um código qualquer, é apontado o termo clsCommonDialog , com o erro:
Erro de compilação. O tipo definido pelo usuário não foi definido , o que me impede antecipar erros nos códigos que estou trabalhando.
Alguém sabe como resolver isso?
Public Function fFileDialogSnapshot() As String
' Calls the API File Open Dialog Window
' Returns full path to existing Snapshot File
On Error GoTo Err_fFileDialog
' Call the File Common Dialog Window
Dim clsDialog As Object
Dim strTemp As String
Dim strFname As String
Set clsDialog = New clsCommonDialog
' Fill in our structure
' I'll leave in how to select Gif and Jpeg to
' show you how to build the Filter in case you want
' to use this code in another project.
clsDialog.Filter = "SNAPSHOT (*.SNP)" & Chr$(0) & "*.SNP" & Chr$(0)
'clsDialog.Filter = "ALL (*.*)" & Chr$(0) & "*.*" & Chr$(0)
clsDialog.hDC = 0
clsDialog.MaxFileSize = 256
clsDialog.Max = 256
clsDialog.FileTitle = vbNullString
clsDialog.DialogTitle = "Please Select a Snapshot File"
clsDialog.InitDir = vbNullString
clsDialog.DefaultExt = vbNullString
' Display the File Dialog
clsDialog.ShowOpen
' See if user clicked Cancel or even selected
' the very same file already selected
strFname = clsDialog.FileName
If Len(strFname & vbNullString) = 0 Then
' Do nothing. Add your desired error logic here.
End If
' Return File Path and Name
fFileDialogSnapshot = strFname
Exit_fFileDialog:
Err.Clear
Set clsDialog = Nothing
Exit Function
Err_fFileDialog:
fFileDialogSnapshot = ""
MsgBox Err.Description, vbOKOnly, Err.Source & ":" & Err.Number
Resume Exit_fFileDialog
End Function
Estou usando este código, em conjunto com outros, para converter um arquivo .snp em .pdf.
O que está me incomodando é que sempre que compilo um código qualquer, é apontado o termo clsCommonDialog , com o erro:
Erro de compilação. O tipo definido pelo usuário não foi definido , o que me impede antecipar erros nos códigos que estou trabalhando.
Alguém sabe como resolver isso?
Public Function fFileDialogSnapshot() As String
' Calls the API File Open Dialog Window
' Returns full path to existing Snapshot File
On Error GoTo Err_fFileDialog
' Call the File Common Dialog Window
Dim clsDialog As Object
Dim strTemp As String
Dim strFname As String
Set clsDialog = New clsCommonDialog
' Fill in our structure
' I'll leave in how to select Gif and Jpeg to
' show you how to build the Filter in case you want
' to use this code in another project.
clsDialog.Filter = "SNAPSHOT (*.SNP)" & Chr$(0) & "*.SNP" & Chr$(0)
'clsDialog.Filter = "ALL (*.*)" & Chr$(0) & "*.*" & Chr$(0)
clsDialog.hDC = 0
clsDialog.MaxFileSize = 256
clsDialog.Max = 256
clsDialog.FileTitle = vbNullString
clsDialog.DialogTitle = "Please Select a Snapshot File"
clsDialog.InitDir = vbNullString
clsDialog.DefaultExt = vbNullString
' Display the File Dialog
clsDialog.ShowOpen
' See if user clicked Cancel or even selected
' the very same file already selected
strFname = clsDialog.FileName
If Len(strFname & vbNullString) = 0 Then
' Do nothing. Add your desired error logic here.
End If
' Return File Path and Name
fFileDialogSnapshot = strFname
Exit_fFileDialog:
Err.Clear
Set clsDialog = Nothing
Exit Function
Err_fFileDialog:
fFileDialogSnapshot = ""
MsgBox Err.Description, vbOKOnly, Err.Source & ":" & Err.Number
Resume Exit_fFileDialog
End Function