Strange Problem with Microsoft Excel & MS

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
rjw524
Pro Scripter
Posts: 104
Joined: Wed May 09, 2012 9:45 pm
Location: Michigan

Strange Problem with Microsoft Excel & MS

Post by rjw524 » Thu Sep 15, 2016 8:57 pm

Hello,

I'm having a problem with sending commands between Excel workbooks that I've never had before.

I have two excel workbooks open and I need to do a very simple copy from one workbook and paste to the other. Something I've done using MS tens of thousands of times by this point.

One file is an excel workbook, the other is a CSV file that is sent to me through my job's database and automatically opened.

The data I need to copy is in File A.

I set the focus to File A. MS actually goes to File A just fine.

It correctly selects the range I need to copy in File A, but for some odd reason it performs the copy in FILE B.

The macro is written correctly. I am not inadvertently telling it to copy the range in File B.

Any idea what this is about?

(NOTE: I know there are native excel functions in MS, but for work related reasons, I have to do it with both workbooks open.)

Thanks,

RJ

rjw524
Pro Scripter
Posts: 104
Joined: Wed May 09, 2012 9:45 pm
Location: Michigan

Re: Strange Problem with Microsoft Excel & MS

Post by rjw524 » Thu Sep 15, 2016 9:56 pm

Update:

So I did some playing around with the macro, (playing with window settings, handles, etc.)

Macro Scheduler is behaving as if it doesn't even see the CSV file (aka File A).

It's weird, because it shows File A in the "Window Title" drop down box in the "SetFocus" dialog box.

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

Re: Strange Problem with Microsoft Excel & MS

Post by Marcus Tettmar » Fri Sep 16, 2016 9:33 am

Almost impossible to guess without seeing code to see what you mean. A screencast would help.

But sounds like an issue with a SetFocus, perhaps matching a different window - perhaps the match is not specific enough and it's seeing a different window, perhaps you need to set WF_TYPE. Again, it's all guess work without being able to see the code and maybe some screenshots.

I would be using the native XL functions. You can still have both workbooks open. So not sure what you mean there.
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
Sign up to our newsletter for free automation tips, tricks & discounts