Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2008

Tip: Looking for answers? Try searching our database.

Export code not working in new version

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Irshad Alam - 17 May 2008 07:39 GMT
I have a .mdb which I made on Windows XP and MS office 2000. The following
code is working fine:

Function ExpoXLS()
Dim rptCurrentReport As Report
Set rptCurrentReport = Screen.ActiveReport
DoCmd.OutputTo acOutputReport, rptCurrentReport.Name,
"MicrosoftExcel(*.xls)", "C:\" & rptCurrentReport.Name & Date & ".xls", True,
""""
End Function

The same mdb I am using on Windows Vista and Ms Office 2003, its producing
error for the above code.

I could not understand, whats the problem. Please suggest me.

Regards.

Irshad
Ron Weiner - 17 May 2008 15:53 GMT
Vista Security is undoubtedly not allowing you to write the file in the root
directory of the C: drive.  Hard coding an output file location as you are
doing here was bound to fail sooner or later.  The answer is to create the
file in a place that the user has write privileges.  There has been lots of
discussion about this and other Vista related security changes.  You will
need to do a little reading on the subject.

As an aside you really ought to have an error handler in a routine like
this, where it wants to create a file.  I also do not understand why it is a
Function.  I do not see it either declaring a return type or returning a
value.

Ron W
>I have a .mdb which I made on Windows XP and MS office 2000. The following
> code is working fine:
[quoted text clipped - 16 lines]
>
> Irshad
Irshad Alam - 18 May 2008 09:31 GMT
Sir,

Actually I am not very good in VBA coding. I just manage to write it anyhow,
therefore I could not write the error handling codes.

Reason for using this in function is that I am using this function in the
toolbar. This tool bar is shown in the report, if user wants to export is to
excel, he clicks and the current screen report is exported to excel. It was
working fine in Windows XP and office 2000.

Please suggest any alternate way to handle this situation, as it is required
badly.

Regards

Irshad

> Vista Security is undoubtedly not allowing you to write the file in the root
> directory of the C: drive.  Hard coding an output file location as you are
[quoted text clipped - 29 lines]
> >
> > Irshad
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.