Saving generated excel

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
WoutV
Newbie
Posts: 5
Joined: Mon Mar 30, 2020 10:07 am

Saving generated excel

Post by WoutV » Mon Mar 30, 2020 10:22 am

Hello everybody,

I've searched the topic yet could not find a solutions to my problem:
We're trying to save a generated excel file (generated by our accounting software) to a specific location.
Currently I've made a dialog to request the directory where the file should be saved to.

Getting the excel file from te software works, yet when trying to save the file there is only a part of the directory copied (last part) resulting in a failure to save seen the directory is incomplete.

Can anybody help me? I've attached the code, "varLocatie" is the name of the dialog part where the directory needs to be copied.

Thanks, Wout

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1386
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Saving generated excel

Post by Dorian (MJT support) » Mon Mar 30, 2020 10:44 am

I'm not 100% sure i follow, but let's see.

If I edit part of your script slightly, to make sure varLocatie is as it was entered, we see that all is as expected.

Code: Select all

......
Else
  MessageModal>User Cancelled
Endif

//MJT edit
MessageModal>varLocatie
exit

Press F12
Wait>0.1
SendText>Name file
.....
So is the issue that when you use Send>varLocatie in the last line of your script, it's not sending the entire string?

I'm assuming if it's typing something in the box, we can confirm focus is set.

If so, let's try slowing down the SendText, as maybe it's overwhelming i's target. Add this near the top of your script :

Let>SK_delay=150

It's fine to experiment with the values. 150 will pause for 150 milliseconds between keystrokes.

Or... Try using the FindObject Wizard to enter varLocatie wherever you want it to go.
Yes, we have a Custom Scripting Service. Message me or go here

WoutV
Newbie
Posts: 5
Joined: Mon Mar 30, 2020 10:07 am

Re: Saving generated excel

Post by WoutV » Mon Mar 30, 2020 11:49 am

Hi Dorian,

Thanks for the answer, it seems to be working now.
I've tested lowering the delay and ended up having the original problem.

Thanks!

WoutV
Newbie
Posts: 5
Joined: Mon Mar 30, 2020 10:07 am

Re: Saving generated excel

Post by WoutV » Mon Mar 30, 2020 1:58 pm

Dear,

It works!
Seems like time was indeed all we needed..

Thanks!

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1386
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Saving generated excel

Post by Dorian (MJT support) » Mon Mar 30, 2020 4:43 pm

Excellent! Great to hear. Thank you for the feedback.
Yes, we have a Custom Scripting Service. Message me or go here

Ranger762
Newbie
Posts: 7
Joined: Thu Mar 26, 2020 9:55 am

Re: Saving generated excel

Post by Ranger762 » Mon Mar 30, 2020 7:07 pm

Great, I've managed to do so based on that thread, it helps me A LOT! I've got to prepare investment scenarios for almost a German commercial real estate, so there's a lot of Excel generation to do, and Macro Scheduler turns it into a human-sized task, fortunately enough.

WoutV
Newbie
Posts: 5
Joined: Mon Mar 30, 2020 10:07 am

Re: Saving generated excel

Post by WoutV » Tue Apr 14, 2020 2:11 pm

Is there a way to work around the TAB portion to go to the directory to save the document?
It seems that every first time I need 11 x tab, yet second time I run the script it's 12x tab.
The saving directory is asked for in the dialog, file name doesn't necessarily need to change..

Thanks!

User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Saving generated excel

Post by Grovkillen » Tue Apr 14, 2020 2:37 pm

Use VBA for saving, that way is solid.
Let>ME=%Script%

Running: 15.0.27
version history

WoutV
Newbie
Posts: 5
Joined: Mon Mar 30, 2020 10:07 am

Re: Saving generated excel

Post by WoutV » Thu Apr 16, 2020 7:21 am

I'm not currently still learning everything and not very skilled so far.
Have you got an example or a link to a tutorial of some kind?

Thanks W.

User avatar
Grovkillen
Automation Wizard
Posts: 1131
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Saving generated excel

Post by Grovkillen » Thu Apr 16, 2020 11:16 am

If you record s macro within Excel where you have the file you can look it through and convert it to code to use with Macro Scheduler
Let>ME=%Script%

Running: 15.0.27
version history

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts