Jump to content

Recommended Posts

Posted

For some reason my FileExists statement will not work. Can anyone see what I am doing wrong?

Statement to save excel file (enters data in save as box and clicks enter).

If $domestic <> "D" then

Send("C:\"&$short_name&" International Detail "&$remit&"")

Send("{ENTER}")

EndIf

Statement to close excel once file has saved:

If $domestic <> "D" then

While $flag = 0

If FileExists("C:\"&$short_name&" International Detail "&$remit&".xls") Then

ProcessClose("excel.exe")

ExitLoop

EndIf

WEnd

EndIf

Posted
Posted (edited)

u gonna need to but a couple of debug points in your code to see what value $Domestic $Flag are returning.

put a messagebox(0,"Value of $Domestic + $Flag",$Domestic&" "&$Flag)

before both your save and close excel If statemnts. Other than that we need a bit more code to see what you actually defining in those variables.

HardCopy

Edited by HardCopy

Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

Posted

I have done this, and everything comes back the way that it should be before saving, and closing. Both have the same value, but for some reason I can not get it to recognize the file using fileexists.

Posted

Try putting this line in there:

InputBox('Test', 'FilePath', "C:\"&$short_name&" International Detail "&$remit&".xls")

And if it looks normal, copy from the input box, and paste into your Start>Run dialog, and try to execute like that. If that works fine, then I'll be stumped.

Posted

I am getting a "block". Looks to be a carriage return right before .xls

Am I constructing my string wrong?

FileExists("C:\"&$short_name&" International Detail "&$remit&".xls")

Posted

If $domestic <> "D" then

Send("C:\"&$short_name&" International Detail "&$remit&"")

Send("{ENTER}")

EndIf

Well u tagging an extra null on the end here!! dunno if that would kill it.

change "" to ".xls" try that

Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

Posted

If $domestic <> "D" then

Send("C:\"&$short_name&" International Detail "&$remit&"")

Send("{ENTER}")

EndIf

Well u tagging an extra null on the end here!! dunno if that would kill it.

change "" to ".xls" try that

<{POST_SNAPBACK}>

try putting a space on either side of each of your &'s... if nothing else it will help readability. i know in vbs it doesn't like it when &'s are appended to variable names.
Posted

I see what is happening. I am drawing in a carriage return when grabbing the remit number from a file. Is there a string command to strip a string of carriage returns?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...