Results 1 to 2 of 2

Thread: VBA Playing silly buggas

  1. #1
    LSemmens
    lsemmens's Avatar
    Join Date
    Dec 2011
    Location
    Rural South OZ
    Posts
    10,585
    Thanks
    11,867
    Thanked 7,061 Times in 3,338 Posts
    Rep Power
    3153
    Reputation
    132592

    Default VBA Playing silly buggas

    I've got some fairly simple documents that I've created to display a Chord Chart on screen for various songs that I play in Church. So far, so good. Some of the songs need to be transposed to suit either a backing track or the requirements of the vocalists. So far, so good! I've formatted the documents for ease of reading and included the transposition at the appropriate lines on the page so that I can easily switch between the two. I've hundreds of lines of VBA code to automatically format various sections of the the document. On only ONE document This line Fails
    Selection.MoveDown unit:=wdLine, Count:=4
    unless I insert a breakpoint in my code to step through the line. It then works as it should.
    As an example this same code is repeated several times in the module to hide/show particular lines. Here is the offending line with the code leading up to it. NOTE: It all works up until this line
    Selection.MoveDown unit:=wdLine, Count:=2
    Selection.MoveDown unit:=wdLine, Count:=1, Extend:=wdExtend
    t = HideLine()
    Selection.MoveDown unit:=wdLine, Count:=2
    Selection.MoveDown unit:=wdLine, Count:=1, Extend:=wdExtend
    t = HideLine()
    Selection.MoveDown unit:=wdLine, Count:=4
    This same code works in all other documents and works if I actually pause the code on that line and step through it, otherwise, all that happens is The selection only moves down one line as though it has hit the EOF, which it most certainly has not.

    I'm not expecting any assistance, just having a rant!
    I'm out of my mind, but feel free to leave a message...



Look Here ->
  • #2
    Senior Member

    Join Date
    Mar 2008
    Posts
    1,265
    Thanks
    139
    Thanked 643 Times in 368 Posts
    Rep Power
    454
    Reputation
    10815

    Default

    I feel your pain. Far too many times I've had to put workarounds into scripts to cope with weird Microsoft crap. So I started using perl with various modules to manipulate Microsoft format files directly without Word, Excel etc being involved.... and it has a lot of weird crap too. But at least it's consistent weird crap, not random randomly triggering crap like you get with Microsoft.

  • 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
    •