cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Usr21
Frequent Visitor

PAD (excel) failed to write error

Hi everyone, I get this error from PAD.

 

Speichern des Excel-Dokuments „ 'C:\Users\***\Desktop\0100 - File'“ fehlgeschlagen

means in english Failed to write „ 'C:\Users\***\Desktop\0100 - File'“.

 

This is the path for save "%SpecialFolderPath%\%Name%.xlsx"

 

What is the solution for this issue?

 

Thanks in advance

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Usr21
Frequent Visitor

@burque505thank you for your support 👍

 

I've solved it this way

 

Folder.GetSpecialFolder SpecialFolder: Folder.SpecialFolder.DesktopDirectory SpecialFolderPath=> Desktop
Excel.LaunchAndOpen Path: $'''%Desktop%\\Vorlagen\\Data.xlsx''' Visible: False ReadOnly: True LoadAddInsAndMacros: False Instance=> Data
Excel.GetFirstFreeColumnRow Instance: Data FirstFreeColumn=> FirstFreeColumn FirstFreeRow=> FirstFreeRow
Excel.ReadCells Instance: Data StartColumn: $'''A''' StartRow: 1 EndColumn: FirstFreeColumn - 1 EndRow: FirstFreeRow - 1 ReadAsText: True FirstLineIsHeader: True RangeValue=> ExcelData
LOOP FOREACH CurrentItem IN ExcelData
    Excel.LaunchAndOpen Path: $'''%Desktop%\\Vorlagen\\Blanko_Voll- und Teilzeit.xlsx''' Visible: False ReadOnly: True LoadAddInsAndMacros: False Instance=> ExcelInstance
    Excel.WriteCell Instance: ExcelInstance Value: CurrentItem['ZEILE I'] Column: $'''G''' Row: 1
    Excel.WriteCell Instance: ExcelInstance Value: CurrentItem['ZEILE II'] Column: $'''G''' Row: 2
    Excel.WriteCell Instance: ExcelInstance Value: CurrentItem['ZEILE III'] Column: $'''G''' Row: 3
    Excel.CloseAndSaveAs Instance: ExcelInstance DocumentFormat: Excel.ExcelFormat.OpenXmlWorkbook DocumentPath: $'''%Desktop%\\Vorlagen\\%CurrentItem['ZEILE I']%'''
END
Excel.Close Instance: Data

 

 

Maybe this helps others.

View solution in original post

3 REPLIES 3
Usr21
Frequent Visitor

Maybe this help to understand better my issue.

This is my PAD Code (changed the path name)

 

 

 

Folder.GetSpecialFolder SpecialFolder: Folder.SpecialFolder.DesktopDirectory SpecialFolderPath=> Desktop
Excel.LaunchAndOpen Path: $'''%Desktop%\\Vorlagen\\Data.xlsx''' Visible: False ReadOnly: False LoadAddInsAndMacros: False Instance=> Data
Excel.GetFirstFreeColumnRow Instance: Data FirstFreeColumn=> FirstFreeColumn FirstFreeRow=> FirstFreeRow
Excel.ReadCells Instance: Data StartColumn: $'''A''' StartRow: 1 EndColumn: $'''A''' EndRow: FirstFreeRow - 1 ReadAsText: True FirstLineIsHeader: True RangeValue=> Zeile1
Excel.ReadCells Instance: Data StartColumn: $'''B''' StartRow: 1 EndColumn: $'''B''' EndRow: FirstFreeRow - 1 ReadAsText: True FirstLineIsHeader: True RangeValue=> Zeile2
Excel.ReadCells Instance: Data StartColumn: $'''C''' StartRow: 1 EndColumn: $'''C''' EndRow: FirstFreeRow - 1 ReadAsText: False FirstLineIsHeader: True RangeValue=> Zeile3
Excel.Close Instance: Data
LOOP FOREACH CurrentItem IN Zeile1
    Excel.LaunchAndOpen Path: $'''%Desktop%\\Vorlagen\\Blanko_Voll- und Teilzeit.xlsx''' Visible: False ReadOnly: False LoadAddInsAndMacros: False Instance=> Data
    Excel.WriteCell Instance: Data Value: Zeile1 Column: $'''G''' Row: 1
    Excel.WriteCell Instance: Data Value: Zeile2 Column: $'''G''' Row: 2
    Excel.WriteCell Instance: Data Value: Zeile3 Column: $'''G''' Row: 3
    Excel.SaveAs Instance: Data DocumentFormat: Excel.ExcelFormat.OpenXmlWorkbook DocumentPath: $'''%Desktop%\\Vorlagen\\%Zeile1%'''
    Excel.Close Instance: Data
END

 

 

Where do I make the mistake?

burque505
Helper V
Helper V

@Usr21, I think the error is in this code segment:

    Excel.SaveAs Instance: Data DocumentFormat: Excel.ExcelFormat.OpenXmlWorkbook DocumentPath: $'''%Desktop%\\Vorlagen\\%Zeile1%'''

You have defined 'Zeile1' as a range, not a document path:

Excel.ReadCells Instance: Data StartColumn: $'''A''' StartRow: 1 EndColumn: $'''A''' EndRow: FirstFreeRow - 1 ReadAsText: True FirstLineIsHeader: True RangeValue=> Zeile1

Try something like this:

Excel.SaveAs Instance: Data DocumentFormat: Excel.ExcelFormat.OpenXmlWorkbook DocumentPath: $'''%Desktop%\\Vorlagen\\MeinTestDokument.xlsx'''

If that works, you can create a variable with the desired document path and substitute that in to the code above.

 

Usr21
Frequent Visitor

@burque505thank you for your support 👍

 

I've solved it this way

 

Folder.GetSpecialFolder SpecialFolder: Folder.SpecialFolder.DesktopDirectory SpecialFolderPath=> Desktop
Excel.LaunchAndOpen Path: $'''%Desktop%\\Vorlagen\\Data.xlsx''' Visible: False ReadOnly: True LoadAddInsAndMacros: False Instance=> Data
Excel.GetFirstFreeColumnRow Instance: Data FirstFreeColumn=> FirstFreeColumn FirstFreeRow=> FirstFreeRow
Excel.ReadCells Instance: Data StartColumn: $'''A''' StartRow: 1 EndColumn: FirstFreeColumn - 1 EndRow: FirstFreeRow - 1 ReadAsText: True FirstLineIsHeader: True RangeValue=> ExcelData
LOOP FOREACH CurrentItem IN ExcelData
    Excel.LaunchAndOpen Path: $'''%Desktop%\\Vorlagen\\Blanko_Voll- und Teilzeit.xlsx''' Visible: False ReadOnly: True LoadAddInsAndMacros: False Instance=> ExcelInstance
    Excel.WriteCell Instance: ExcelInstance Value: CurrentItem['ZEILE I'] Column: $'''G''' Row: 1
    Excel.WriteCell Instance: ExcelInstance Value: CurrentItem['ZEILE II'] Column: $'''G''' Row: 2
    Excel.WriteCell Instance: ExcelInstance Value: CurrentItem['ZEILE III'] Column: $'''G''' Row: 3
    Excel.CloseAndSaveAs Instance: ExcelInstance DocumentFormat: Excel.ExcelFormat.OpenXmlWorkbook DocumentPath: $'''%Desktop%\\Vorlagen\\%CurrentItem['ZEILE I']%'''
END
Excel.Close Instance: Data

 

 

Maybe this helps others.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,582)