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
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Top Kudoed Authors
Users online (2,794)