There is one cell that contains a dollar sign in the text ($) that the exported file is not adding. It's also emitting the first number after the sign.
This is the original string in the range:
"Pfizer, BioNTech, and Moderna make a combined $65,000 per minute profit"
And this is what my code is writing to the file:
"Pfizer, BioNTech, and Moderna make a combined 5,000 per minute profit"
Is there a function that I can use to force AHK to see the entire string as text?
Here's my code:
Code: Select all
MyPath := "F:\AHK\"
FilePath := "F:\AHK\Words.xlsm"
if ErrorLevel
return
else
{
xlApp := ComObjCreate("Excel.Application")
xlWB := xlApp.Workbooks.Open(FilePath,0,0)
xlApp.Visible := false
xlWS := xlApp.Sheets("USED")
xlApp.Range("rng_HELPER_SORT").Sort(xlApp.Range("A1"),,,,,,,1) ; with Header
HtmlArr := xlApp.Range("rng_HTML")
for cell in HtmlArr
{
dataPuzNum.= cell.Offset(0, -8).text "`n"
dataHTML.= cell.text "`n"
}
FileRead, OutputVar, %MyPath%003_13x13.cfp
NewValPuzNum := RegExReplace(OutputVar, "s)<WORDS>\K.*?(?=</WORDS>)", "`n" . dataPuzNum)
NewValHTML := RegExReplace(OutputVar, "s)<WORDS>\K.*?(?=</WORDS>)", "`n" . dataHTML)
FileAppend, %NewValPuzNum%, %MyPath%TmpPuzNum.txt
FileAppend, %NewValHTML%, %MyPath%TmpHTML.txt
}
done:
;xlWB.Save()
xlWB.Close(0) ;SaveChanges:=False
xlApp.Quit()
xlApp := xlWB := ""
msgbox, finished
ExitApp