+ Reply to Thread
Results 1 to 11 of 11

Code will run in editor but will not run with hotkey

  1. #1
    Registered User
    Join Date
    10-31-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    10

    Code will run in editor but will not run with hotkey

    This is my first attempt at programming. This takes a comma delimited text file created by another program and converts into a format readable by a different program. When I run it through the editor immediate window it works just fine but when I run it with a hotkey it stops after opening the requested file. Any ideas would be appreciated. The attached file is the text file similar to the ones opened by this macro

    Thanks


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kirk70; 10-31-2013 at 01:21 PM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: Code will run in editor but will not run with hotkey

    try removing the first workbook.open command

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    10-31-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Code will run in editor but will not run with hotkey

    Hi Andy

    I tried what you suggested. It still will not run off the hot key.

    thanks

    I think I spoke too soon. Its still not working all the way through but it is moving further through the code. I will let you know where it stopped
    Last edited by kirk70; 10-31-2013 at 12:49 PM.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: Code will run in editor but will not run with hotkey

    probably falls over at

    Please Login or Register  to view this content.
    the constant is xlToLeft

  5. #5
    Registered User
    Join Date
    10-31-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Code will run in editor but will not run with hotkey

    It appears that there is some problem in the attached lines. It seems to stop right after.
    Please Login or Register  to view this content.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: Code will run in editor but will not run with hotkey

    what is the hotkey you are using.

    In my test I used CTRL+SHIFT+U and it worked fine (after corrections already detailed).

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Code will run in editor but will not run with hotkey

    probably worth testing with a hotkey combo that doesn't use Shift
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  8. #8
    Registered User
    Join Date
    10-31-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Code will run in editor but will not run with hotkey

    It works with a ctrl m Why would that make a difference?

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Code will run in editor but will not run with hotkey

    bug in excel. because shift is the key used to prevent code running automatically when you open a file, using a shortcut key with shift can stop your code in its tracks when it opens a file. I've gotta admit I didn't know it happened with opentext too

  10. #10
    Registered User
    Join Date
    10-31-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Code will run in editor but will not run with hotkey

    Thanks Joseph
    thats good to know

  11. #11
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: Code will run in editor but will not run with hotkey

    Thanks JosephP, I was testing in xl2010 and CTRL+SHIFT+M works.
    But I can confirm xl2007 stops after import.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Cant open VBA code editor out of memory
    By Wade073 in forum Excel General
    Replies: 1
    Last Post: 03-19-2012, 05:33 AM
  2. Adding Hotkey to Macro with Code?
    By Neg0r in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-12-2011, 07:42 AM
  3. managing code in vba editor
    By fozze in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-30-2008, 09:55 AM
  4. Macro works in VBA editor but not when run with hotkey
    By cambotb in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-02-2008, 02:20 AM
  5. Closing the VBA Editor using code
    By Bony_Pony in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-07-2005, 04:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1