I'm trying to simplify file selection using the following file name variable and getting "Couldn't find file" error. Played around with it , and still same error
FileToName := Perm
xlApp := ComObjActive("Excel.Application")
FileTo_Path := A_Desktop "\%FileToName%.xlsx"
FileTo := xlApp.Workbooks.Open(FileTo_Path)
Variable not recognized in Excel application
Re: Variable not recognized in Excel application
A couple of problems (at least). Here are a couple corrections:
Code: Select all
FileToName := "Perm" ; otherwise you're naming it the contents of the variable named Perm, which is probably empty
xlApp := ComObjActive("Excel.Application")
FileTo_Path := A_Desktop "\" FileToName ".xlsx" ; fixed a couple things here
FileTo := xlApp.Workbooks.Open(FileTo_Path)
Re: Variable not recognized in Excel application
Works great. Thanks again bud
Re: Variable not recognized in Excel application
Can enter FileToName from an input box like this somehow?
FileToName := "F"
InputBox, F,,Destination file
xlApp := ComObjActive("Excel.Application")
FileTo_Path := A_Desktop "\" FileToName ".xlsx"
FileTo := xlApp.Workbooks.Open(FileTo_Path)
FileToName := "F"
InputBox, F,,Destination file
xlApp := ComObjActive("Excel.Application")
FileTo_Path := A_Desktop "\" FileToName ".xlsx"
FileTo := xlApp.Workbooks.Open(FileTo_Path)
Re: Variable not recognized in Excel application
Get rid of the first line. Doesn't make sense to assign a string "F" to the variable. It seems like you think you're linking it to the variable named F from the next line, but it's not doing anything like that.
In the InputBox command, just replace F with FileToName.
In the InputBox command, just replace F with FileToName.
Re: Variable not recognized in Excel application
Thank you sir