Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Jun 2009
    Location
    Hemet CA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking

    I have a few different types of bookmarks, what I mean by different is, some are text only and others are phone numbers,
    currency and time
    I know how to use code for Text
    Code:
    Set oRng = oBM("Name").Range
    oRng.Text = Me.TextBox1.Text
    oBM.Add "Name", oRng
    and for a phone number
    Code:
    Set oRng = oBM("Phone").Range
    oRng.Text = Format(Me.TextBox2.Text, "(###) ###-####")
    oBM.Add "Phone", oRng
    I trying to figure how to do currency and time
    Also is it possible to make changes from the textboxes them self

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    Quote Originally Posted by ababenchrist' post='794643 View Post
    Also is it possible to make changes from the textboxes them self
    If you are using Word's legacy form controls, they can be wired to a macro that runs when the user exits the control. This can be set in the Properties for the text box (the macro must exist first).

  3. #3
    3 Star Lounger
    Join Date
    Jun 2009
    Location
    Hemet CA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I was playing around a little and I was able to come up with this for currency
    Code:
    Set oRng = oBM("Fees").Range
    oRng.Text = Format(Me.TextBox3.Value, "$#,##0.")
    oBM.Add "Fees", oRng
    This seems to work OK, except when I re-populated with new data it shifts old data to the right side of Bookmark.
    I do use 2 bookmarks that use a currency and only one shifts the data over, the other doesnt. I looked it over and I couldnt spot anything, Of course I'm not really sure what to look for.

  4. #4
    3 Star Lounger
    Join Date
    Jun 2009
    Location
    Hemet CA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='jscher2000' post='794651' date='23-Sep-2009 21:17']These articles are for Visual Studio (Visual Basic.NET), but I believe the syntax for user-defined formats has not changed, or at least not enough to make a difference:

    User-Defined Date/Time Formats (Format Function)
    User-Defined Numeric Formats (Format Function)


    If you are using Word's legacy form controls, they can be wired to a macro that runs when the user exits the control. This can be set in the Properties for the text box (the macro must exist first).[/quote]
    Thank you jscher2000
    I'll check that out

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    [quote name='ababenchrist' post='794656' date='23-Sep-2009 22:20']I was playing around a little and I was able to come up with this for currency
    Code:
    Set oRng = oBM("Fees").Range
    oRng.Text = Format(Me.TextBox3.Value, "$#,##0.")
    oBM.Add "Fees", oRng
    This seems to work OK, except when I re-populated with new data it shifts old data to the right side of Bookmark.
    I do use 2 bookmarks that use a currency and only one shifts the data over, the other doesnt. I looked it over and I couldnt spot anything,[/quote]
    It sounds as though the old text is somehow not part of the range so that when you re-apply the bookmark, it is not getting included. You could add oRng.Select before you insert the text to see what it includes, and oRng.Select after you insert the text to see what it covers at that point. You'll want to single-step through the procedure so you can see what's happening in the document.

  6. #6
    3 Star Lounger
    Join Date
    Jun 2009
    Location
    Hemet CA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi jscher2000
    Thank you so much for your assistance, I got it working as it should.

Posting Permissions

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