Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export as txt file and saving as current date daily

Status
Not open for further replies.

Ajaygupta

Programmer
Mar 24, 2003
21
0
0
IN
Sridharan
hi,

I have doing all this by using macro.
dim x
x=now()

i am call after refresh event. then i am calling
call activedocument.exportastext(.................)
but the problem in exportastext properties the file same should be string. how I can save as varival(x).


rgs

 
You cannot export the document as a Text but only the report since a document can contain many sheets. You can export it as a PDF or HTML though. One more thing is when you get the Date using NOW() it contains "/" which cannot be part of filenames. Try this code...

Code:
Dim FName As String
Dim Doc As busobj.Document
Dim Rep As busobj.Report
Dim Dateval

Sub ExportText()
    Dateval = CDate(Now())
    FName = Day(Dateval) & "-" & Month(Dateval) & "-" & Year(Dateval)
    ActiveDocument.ActiveReport.ExportAsText ("C:\\" & FName)
End Sub

Regards,
Sri
 
Sridharn hi

Thans a lot......

I am using following code

Private Sub Document_AfterRefresh()
Call ActiveDocument.ActiveReport.ExportAsText("c:\ord_main")
End Sub

above file name is ORD_MAIN. once it refresh it export as text file. that is ord_main.txt.

2- following code I ma exporting as html file -name is West. in place of file name WEST I want now() or sysdate. becasue I want to stroe daily refreshed HTML file in one dir. and provideing user to hyperlink so that the can see the old date data also.

Private Sub Document_AfterRefresh()
Call ActiveDocument.ActiveReport.ExportAsHtml("c:\west", True, True, True, True, True, True, True, 0, 1)
End Sub

let me try I will come back to you very soon,

regards.







 
Yes you can use the given code and substitute the variable for the report name. remember though that when one saves the report as HTML with frames then this name will be applied only to the main file which gets created.

Code:
Private Sub Document_AfterRefresh()
    Dateval = CDate(Now())
    FName = Day(Dateval) & "-" & Month(Dateval) & "-" & Year(Dateval)
Call ActiveDocument.ActiveReport.ExportAsHtml(("C:\\" & FName, True, True, True, True, True, True, True, 0, 1)
End Sub

Sri

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top