Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 01-29-2015, 08:13 AM
gmayor's Avatar
gmayor gmayor is offline VBA to Open a Document to a Specific Heading Windows 7 64bit VBA to Open a Document to a Specific Heading Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

I don't work in Access, but the principles of opening a document and processing it from VBA are fairly universal and go something like the following code. One way to open at your heading would would be to set a named bookmark at the start of that location (say "bkHeading1") and then select that bookmark e.g.

Code:
Dim wdApp As Object
Dim wdDoc As Object
    On Error Resume Next
    Set wdApp = GetObject(, "Word.Application")
    If Err Then
        Set wdApp = CreateObject("Word.Application")
    End If
    On Error GoTo 0
    Set wdDoc = wdApp.Documents.Open(Filename:="C:\Path\DocName.docx")
    wdDoc.Range.bookmarks("bkHeading1").Select
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 

Tags
heading numbering, search, vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA to Open a Document to a Specific Heading How to Restore Heading 1, Heading 2, etc. within a Word Document cheech1981 Word 9 01-11-2017 02:14 AM
VBA to Open a Document to a Specific Heading Formula to open external file with specific program (like open with) pemartins Excel 16 02-24-2014 11:39 PM
VBA to Open a Document to a Specific Heading Deleting A blank Line that has a specific heading style , word 2010 & 2013 SteveWcg Word 5 01-08-2014 10:37 PM
VBA to Open a Document to a Specific Heading Macro to replace one specific heading style with another ubns Word VBA 44 09-04-2012 08:17 PM
VBA to Open a Document to a Specific Heading Using Hyperlink to open Word Document at Specific Header rossi45 Word 2 05-04-2012 06:03 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft