Results 1 to 3 of 3
  1. #1
    mfwhatley is offline Novice
    Windows 10 Access 2016
    Join Date
    Apr 2020
    Posts
    1

    create a cmb Macro that will find spaces in txtbox and change them to thin spaces. ChrW(8201)

    I am trying to create a Marco for a command button that with find the spaces in a text box and change them into thin spaces.

    My code is

    Private Sub cmbShrink_Click()


    Dim b As String


    b=me.txtBullet.value
    me.txtBullet.Value=Replace(b, " ", ChrW(8201))

    End Sub

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Never heard of thin spaces.

    What is 'cmb' macro?

    What is issue - error message, wrong result, nothing happens?

    ChrW(8201) returns a ? character in immediate window.

    I found code for MS Word to accomplish this. However, immediate window in Word has same result.
    Last edited by June7; 04-26-2020 at 09:28 AM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    that code works for me in a mockup form

    Click image for larger version. 

Name:	Capture.PNG 
Views:	5 
Size:	1.6 KB 
ID:	41677
    you can see the lower textbox the spaces are slightly narrower

    with 5 spaces between characters

    Click image for larger version. 

Name:	Capture1.PNG 
Views:	5 
Size:	1.6 KB 
ID:	41678

    so what is the problem?

    you can also simplify the code to

    txtBullet=Replace(txtBullet, " ", ChrW(8201))

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 02-13-2019, 12:42 PM
  2. Replies: 1
    Last Post: 05-03-2013, 01:40 PM
  3. VBA Code (spaces)
    By Rich P in forum Access
    Replies: 1
    Last Post: 03-07-2011, 01:57 PM
  4. Find Spaces in Field
    By stottle in forum Queries
    Replies: 6
    Last Post: 08-17-2009, 02:02 AM
  5. Deleting Spaces
    By grgerhard in forum Import/Export Data
    Replies: 2
    Last Post: 04-30-2006, 06:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums