I am using the following code to create a log file but getting an error
"User-defined type not defined"
Help me
Thanks in advance

Sub main()
Dim dDate As Date
Dim boDP As busobj.DataProvider  'error occured
Dim sLast As String
Dim sFileName As String
Dim sDir As String
Dim dTime As Integer
Dim MyTime As String

''''''Define the path to save the file to
'sDir = "\\ReportDB\CIC\"
sDir = "C:\sample\test"
'Application.Interactive = False
Set boDP = ActiveDocument.DataProviders.Item(1)
sLast = boDP.LastExecutionDate
MyTime = boDP.LastExecutionTime
'The line below captures the last time the report was refreshed.
dDate = CDate(sLast)
dTime = CDate(MyTime)
sFileName = sDir & ActiveDocument.Name & "(" & CStr(Month(dDate)) & "-" & CStr(Day(dDate)) & "-" & CStr(Year(dDate)) & "_" & CStr(Time(dTime)) & ")" & ".pdf"
ActiveDocument.Reports.Item(1).ExportAsPDF (sFileName)
End Sub

Recommended Answers

All 3 Replies

in which line?

in 3rd line "Dim boDP As busobj.DataProvider"

I got an error in above code as "user-defined type not defined"
can anybody help me
thanks in advance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.