P.I. Engineering User Forum

Product Support, Technical Questions and Answers, and Examples for P.I. Engineering Products

You are not logged in.

#26 2017-04-11 17:47:19

GordR
Member
Registered: 2017-04-05
Posts: 17

Re: Shortcut Key says file already open

Amber wrote:

If you edit outside of MacroWorks by directly opening the file you will need to restart MacroWorks completely for your changes to show.

I edit everything in Notepad++ on multiple copies of "Script_1230_1.mw3", (ex: "Script_1230_Bkup01.mw3", "...Bkup04.mw3"), and then use the "File - Load Script".  Much faster to edit, format, comment, subroutines, etc.  No need to restart MacroWorks.  When you "Load Script" it replaces you existing script, (in my case "Script_1230_1.mw3"), so it's good to have backups for when you really mess up, (like making 100 changes and then the script doesn't load at all so you have to go back to a previous working script and make small changes and test each one).  Not that it's ever happened to me. :)

Offline

#27 2017-12-13 11:05:00

skmcrodgers
Member
Registered: 2017-03-14
Posts: 15

Re: Shortcut Key says file already open

Hey Amber.. Been a while and had everything working pretty good but corporate upgraded us to Office 365 and that version of excel displays the title bar differently, so I added some VBA code in excel to rename the title bar to the name I specified but on o365 in the title name it will show the name I gave it ex: Volatile but in o365 it displays Volatile - Excel and this file displays graphs (we use 10 buttons for each file and they all display graphs) and they update every few minutes and saves them once o365 does that it changes the title to Volatile - Saved then after a little while the title is changed back to Volatile - Excel.. weirdest thing ever...so it is continuously is changing the title name and the macroworks code will no longer bring window to front.. if I drag the file shortcut to the button it of course programs the button correctly and will open the file but if you have all 10 opened that way then when you press the button again it displays file already opened etc.. so that is why we edited the code to begin with.. long story short I am wondering if there is another way to call that file to the front so instead of calling it by the title name can you call it to front by the file name? I know ya'll track AppTitle and AppName I was curious if AppName would be the actual file name? if so how would you enter it on the code for each button? sorry to bother you just trying to get this figured out again since the changes and upgrades to new version of excel... as always thanks for your help!!!  i had it working before the upgrade only thing was the files all had to be opened manually first before using the buttons to bring to front..  i figure it would be possible to have the button check first if the file is already opened if not then open the file but i could never get this to work.. if i can get it to work like before by manually opening the file that would be great for now but would love to figure out how to have the buttons open the file when pressed then when pressed again just bring the file to the front and not try to re-open it..any suggestions or if it is possible to call it by file name instead of apptitle name?  thanks !!



Case 1001 'Button 001
      If State 'Pressed    [MWTAG10]
           '<WindowToFront Sample>
           Dim windowtitle As String = "Foundry Lab Report - Volatile.xlsm"
           MW3.WindowToFront(windowtitle)
           '/<WindowToFront Sample>
      Else 'Released       [MWTAG11]
      End If 'Press-Release [/MWTAG10/MWTAG11]

Offline

Board footer

Powered by FluxBB