Results 1 to 3 of 3

Thread: VBA to Word

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    179

    VBA to Word

    Hii all,

    I have made an application to send the values from VB to Word.
    Using bookmarks in word and created a template. Now that template has 25 bookmarks, named as B1, B1E, B2, B2E, B3, 3E, B4, B4E..........B25, B25E.
    Now when i save the data into the template i get an Error, when the value of i=11 i get the error message
    the code goes as follows:----------------------------------------------

    VB Code:
    1. Public FldRng(1 To 25) As Range
    2.  
    3. Public Sub SavePage1()
    4. Dim i As Integer
    5.     For i = 1 To 25
    6.     FldRng(i) = Page1.Text(i)
    7.     Next
    8. Pages.Save
    9. FormChanged = False
    10. End Sub
    11.  
    12. Public Sub SetRanges1()
    13. Dim i As Integer
    14. For i = 1 To 25
    15. [COLOR=YellowGreen]' at this place i get an error[/COLOR]
    16. Set FldRng(i) = Pages.Range(Start:=Pages.Bookmarks(i * 2 - 1).Range.End, _
    17.       End:=Pages.Bookmarks(i * 2).Range.Start - 1)
    18. Next
    19. End Sub
    --------------------------------------------------------------------------

    the above are small Functions that use.
    can someone pls help me.
    thanks
    Last edited by RobDog888; Oct 8th, 2005 at 08:51 PM. Reason: Added [vbcode] tags

  2. #2
    Frenzied Member
    Join Date
    Oct 2003
    Posts
    1,301

    Re: VBA to Word

    And the error is ... ?

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

    Re: VBA to Word

    Moved from Classic VB forum.

    So when i = 11 or bookmark 21 you get the error. What is the error message? What is the data for that array element?
    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

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