Results 1 to 3 of 3

Thread: Word Grid position, some help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Posts
    91

    Word Grid position, some help

    I use Word automation in my VB6 App
    Is it possible to change the grid position?
    I know i can display a grid in Word
    And i can change its GridDistancehorizontal en GridDistancevertical
    But i allso want to offset it's grid position with a left and top value!!
    Is this possible, it's rahter important.
    (I don't want the change the left and top Pagemargin of the Document)
    Last edited by lvermeersch; Jan 23rd, 2006 at 06:44 AM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Word Grid position

    Returns or sets the point, relative to the top of the page, where you want the invisible grid for drawing, moving, and resizing AutoShapes
    VB Code:
    1. With ActiveDocument
    2.     [b].GridOriginHorizontal = InchesToPoints(1)
    3.     .GridOriginVertical = InchesToPoints(2)[/b]
    4.     .GridDistanceHorizontal = InchesToPoints(0.2)
    5.     .GridDistanceVertical = InchesToPoints(0.2)
    6.     .SnapToGrid = True
    7. End With
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Posts
    91

    Re: Word Grid position

    I have tried the suggested .GridOriginHorizontal
    I used
    UMaat = 7 'Centimeter
    Appword.ActiveDocument.GridOriginHorizontal = scalex(1, Umaat, vbPoints)

    Now i allso tried
    Appword.ActiveDocument.GridOriginHorizontal = 10
    Appword.ActiveDocument.GridOriginHorizontal = 20
    or some smaller values
    But nothing change
    if i use msgbox Appword.ActiveDocument.GridOriginHorizontal
    I allways get value 5,65 as a result so the won't change it's value
    What am i doing wrong?
    I try redisplaying the grid but with no effect.
    I do set the grid visible.
    (and the other setting the .GridDistanceHorizontal does work fine)

    Added info
    OKE i just found it
    I had to use first
    .GridOriginFromMargin = false
    This so the grid wont follow the marginssettings anymore.
    Now it follows the Origin given through the code and it works fine
    Last edited by lvermeersch; Jan 23rd, 2006 at 06:56 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width