Lebans ReportToPDF

M

Miha Abrahamsberg

Hi!

I'm using Lebans ReportToPDF and it works great.

But some time ago I started receiving "Compile Error: User-defined type not
defined" when compiling my project. But this not effect the performance of
converting reports to PDF.

The compiling error pops-at for a module containing the fFileDialog()
function at:

###
Set clsDialog = New clsCommonDialog
###

How do I compile?

Thanks in advance!

Miha

################################################
'The complete function code (in the module):
Private Function fFileDialog() As String
' Calls the API File Save Dialog Window
' Returns full path to new 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 = "PDF (*.PDF)" & Chr$(0) & "*.PDF" & Chr$(0)
'clsDialog.Filter = clsDialog.Filter & "Gif (*.GIF)" & Chr$(0) & "*.GIF" &
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 path and Enter a Name for the PDF
File"
clsDialog.InitDir = vbNullString
clsDialog.DefaultExt = vbNullString

' Display the File Dialog
clsDialog.ShowSave

' See if user clicked Cancel or even selected
' the very same file already selected
strFname = clsDialog.fileName
'If Len(strFname & vbNullString) = 0 Then
' Raise the exception
' Err.Raise vbObjectError + 513, "clsPrintToFit.fFileDialog", _
'"Please type in a Name for a New File"
'End If

' Return File Path and Name
fFileDialog = strFname

Exit_fFileDialog:

Err.Clear
Set clsDialog = Nothing
Exit Function

Err_fFileDialog:
fFileDialog = ""
MsgBox Err.Description, vbOKOnly, Err.Source & ":" & Err.Number
Resume Exit_fFileDialog

End Function
############################################################
 
D

Douglas J. Steele

Sounds as though you've got a problem with your References collection.

Assuming Access 2003 or earlier, while in the VB Editor, select Tools |
References from the menu bar and examine all of the selected references
(they'll be at the top of the list)

If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)

Afraid I can't remember exactly where you'll find the References If you're
using Access 2007, but once you find them, the same instructions apply.
 
M

Miha Abrahamsberg

Hi!

I did all you recommended and the problem remains (note: I had none
"missing" references").

Miha
 
D

Douglas J. Steele

Is that fFileDialog in Stephen's code? (It doesn't sound like something he'd
be using)

Have you got the class module named clsCommonDialog in your application?
 
M

Miha Abrahamsberg

No, there is no "clsCommonDialog" class in my project.

If found this comments in Lebans "reportToPDF" code:

'Author: Stephen Lebans
'Email: (e-mail address removed)
'Web Site: www.lebans.com
'Date: May 16, 2008, 11:11:11 PM
'Dependencies: DynaPDF.dll StrStorage.dll clsCommonDialog
..
..
..
is "clsCommonDialog" something I forgot to import into my project?

Miha
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top