Excel with windows 7 Help

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
bmccarter
Newbie
Posts: 3
Joined: Tue Aug 02, 2011 11:20 am

Excel with windows 7 Help

Post by bmccarter » Thu Sep 29, 2011 4:57 pm

I have a script that I cannot get to work with Windows 7. It worked perfect with xp but ever since I moved to 7 It will not work completely. The script goes through everything good until it gets to the part on saving the files. It will open a window in the correct drive to save but it has no file name in the save as column. I am new to doing this so any help would be greatly appreciated.



//Specify the path of the Excel file here
Let>filename=P:\Sigmanest Import Files\SIGMANEST TASK SHEET-BM.xlsx


//Start Excel
ExecuteFile>filename
WaitWindowOpen>Microsoft Excel -*
//Wait>.5

//I'm going to paste the data into Notepad
Run>Notepad.exe
WaitWindowOpen>Untitled - Notepad




let>r=2
Repeat>r


//here is where it gets info and copies

DDERequest>Excel,filename,R%r%C4,field_1,10
StringReplace>field_1,CRLF,,field_1
Let>WF_TYPE=1
SetFocus>Notepad*
SendText>%field_1%


DDERequest>Excel,filename,R%r%C1,field_1,10
StringReplace>field_1,CRLF,,field_1
SetFocus>Notepad*
SendText>%field_1%,



DDERequest>Excel,filename,R%r%C2,field_1,10
StringReplace>field_1,CRLF,,field_1
SetFocus>Notepad*
SendText>%field_1%,1
Press Enter



let>r=r+1
Wait>.15

Until>r=20






// here are the commands to save the files and close the apps

Let>filename=sigmanest task sheet.txt
let>path=P:\Sigmanest Import Files\


Press ALT
SendText>fx
Release ALT
WaitWindowOpen>Save As

//delete file if it exists
IfFileExists>filename,fileexists
Goto>savefile
Label>fileexists
DeleteFile>filename

Label>savefile
SetFocus>Save As
SendText>filename
Press Enter

WaitWindowClosed>
Wait>.8
SetFocus>Notepad*
Press ALT
Send>fx
Release ALT

WaitWindowClosed>
Wait>.8
SetFocus>excel*
Press ALT
Send>fx
Release ALT

Let>CF_OVERWRITE=1
CopyFile>P:\Sigmanest Import Files\sigmanest task sheet.txt,P:\Sigmanest Import Files\sigmanest task sheet.bom

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Sep 29, 2011 7:18 pm

This bit makes no sense to me:
// here are the commands to save the files and close the apps
Let>filename=sigmanest task sheet.txt
let>path=P:\Sigmanest Import Files\

Press ALT
SendText>fx
Release ALT
WaitWindowOpen>Save As
You are sending ALT-fx to Notepad. ALT F-X will CLOSE it (File/Exit). So you're closing Notepad and then waiting for a Save As window.

Doesn't seem right.

Did you mean:

Press ALT
Send>fs
Release ALT

(File/Save)

But can I ask - why paste to Notepad just to save a text file? You can output text to a text files directly using the WriteLn command.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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