Toad World® Forums

Access Denied when running Export


#1

I have automation script that is running two sql jobs and placing in Excel then running a macro. The job never finishes and the Log file i have been getting says the below in italics. This began happening when i downloaded 4.0 yesterday.

I am stumped at this point as to why this is happening

There was an Error running Cashiering- MT.tas

Automation script “Cashiering - MT” had errors while executing. The exception messages are listed below and the log file is attached.

Exception Messages:

Ledger_MT - Access to the path ‘C:\Windows\system32\config\systemprofile’ is denied.

This file was not available at runtime. nThe location and user authentication may be different at runtime.


#2

Hello ewheet2_906,

Could you please clarify which version did you download? Because you wrote 4.0 however the latest is 4.0.1 and in this version i have implemented a bug fix by ensuring that at least an empty “Desktop” folder exists in the mentioned path from your error message. This is a known bug/behavior of the driver that takes care of opening a file in excel.

Could you please manually create the below folders:
C:\Windows\system32\config\systemprofile\Desktop
C:\Windows\SysWOW64\config\systemprofile\Desktop

Then please do let me know whether it helps.

Martin


#3

I’m having the exact same issue. I’m using Toad Data Point version 4.0.1.775. I have an automation script that runs a SQL Server query, exports the data to an Excel file and is then supposed to kick off a macro that formats the file and copies the data to various data tables in other Excel files.

The Toad Export script successfully runs the query and exports the data to the Excel file. However, when it comes time to run the macro (which was selected to run “After export”, I receive the error titled “Export is cancelled”: “Access to the path ‘C:\WINDOWS\system32\config\systemprofile’ is denied. Export is cancelled.” Given that the macro runs successfully from Excel and all I want is TDP to run the macro, this is extremely frustrating. I’ve pasted the log report below. Also, I cannot manually create any folders in that path. Is there another workaround?

10:31:49 AM Thread (28) Export Started [8/2/2018 10:31:49 AM]
10:31:49 AM Thread (28) Export using connection: Stlsqlutil12t (CENTENE\CN148756), Cenpatico
10:31:49 AM Thread (28) Export Wizard: Building object list
10:31:49 AM Thread (28) Exporting Data (1 of 1)
10:31:49 AM Thread (28) Object SQL Query started.
10:31:49 AM Thread (24) InternalReadBackground - after ExecuteReader - command SELECT DISTINCT
*
FROM [dbo].[TAT_Open_Contract_Records]
WHERE 1=1
10:31:49 AM Thread (27) Excel version = 15
10:31:50 AM Thread (30) DoneReadTreadWriter
10:31:50 AM Thread (30) Writing rows 0 - 796
10:31:50 AM Thread (30) Writing rows Finalize
10:31:51 AM Thread (30) Executing macros from Excel.
10:31:51 AM Thread (30) Loading Excel Assemblies
10:31:51 AM Thread (30) Trying Excel 2010
10:31:52 AM Thread (30) Copying macro file from (source file location removed by me)\CopyDataTo_TargetFile_HoldingFile.xlsm to C:\Users***** (also removed by me)\AppData\Roaming\Quest Software\Toad Data Point 4.0\CopyDataTo_TargetFile_HoldingFile.xlsm…
10:31:52 AM Thread (30) Checking if copied file exists: True
10:31:52 AM Thread (30) Creating Dekstop folder for systemprofile: C:\WINDOWS\system32\config\systemprofile\Desktop…
10:31:52 AM Thread (30) Error executing macro
10:31:52 AM Thread (30) Access to the path ‘C:\WINDOWS\system32\config\systemprofile’ is denied.
10:31:52 AM Thread (30) User cancelled
10:31:52 AM Thread (30) DoneReadThreadWriter finally - adapter.RowsRead 796
10:31:52 AM Thread (28) Object SQL Query finished with error: Access to the path ‘C:\WINDOWS\system32\config\systemprofile’ is denied.
10:31:53 AM Thread (28) at Quest.Toad.ImportExport.Writers.WriterExcelInstance.ExecuteMacro(String macroNames, String filename)
at Quest.Toad.ImportExport.Writers.WriterExcel.WriteFooter(Object tableObject)
at Quest.Toad.ImportExport.ExportObjectData.DoneReadThreadWriter()
10:32:56 AM Thread (28) Export Finished [8/2/2018 10:32:56 AM]


#4

The way I handle that issue is to create a small batch program to run the macro. Then just run the batch in TDP.


#5

This issue has been fixed in later releases. If you make that directory and have privs to access the directory the error will go away. We were copying over the xlm files for temporary use.


#6

Debbie,

Thank you for the response.

For those in a similar position where you don’t have admin privs to create the folder structure, I can confirm that if you can have your support *temporarily *grant you those privs or create the 2 folders below, you will then be able to run macros even after the admin rights have been removed following the creation of the folders.

C:\Windows\system32\config\systemprofile\Desktop
C:\Windows\SysWOW64\config\systemprofile\Desktop

Thanks, all!