I cannot saveas the current excel file using the name saved in the clipboard......
Code: Select all
^+Y::
dir = C:\Users\sebas\Desktop\Saved
Gui, New
Gui, Font, s12 w500
Gui, Color, F8DC75
Gui, Add, Text, w320 Center, Please wait....
Gui, Show,, Working
If !FileExist(dir) {
FileCreateDir, %dir%
If ErrorLevel {
Gui, Destroy
MsgBox, 48, Error, An error occurred while creating the directory. Aborting.
Return
}
}
FileRecycle, % file := dir "\" excelFix(Clipboard) ".xlsx"
xl := ComObjCreate("Excel.Application"), x1.visible := true, xl.activeworkbook.Saveas(file)
Gui, Destroy
If FileExist(file)
MsgBox, 64, Done, Done!
Else MsgBox, 48, Error, The file could not be created.`n`n%file%
excelFix(string) {
new := RTrim(string, "`r`n") ; Remove the trailing CRLF
new := Instr(new, "`n") ? RegExReplace(new, """(.+)""", "$1") : new ; Remove bounding quotation marks
Return StrReplace(new, """""", """") ; Fix double quotation marks
}