Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-18-2018, 01:02 PM
klutch klutch is offline Applying bookmarks to multiple documents - is it possible? Windows 7 32bit Applying bookmarks to multiple documents - is it possible? Office 2016 for Mac
Advanced Beginner
Applying bookmarks to multiple documents - is it possible?
 
Join Date: Jun 2018
Posts: 31
klutch is on a distinguished road
Default Applying bookmarks to multiple documents - is it possible?

Hello, I am wondering if it is possible to apply bookmarks to multiple documents (several hundred in this case)? I have a macro that selects a bookmarked cell in a word table and pastes it there. However the document I am pasting into is unique to each performance review. Meaning that technically, each time I run the macro it is pasting into a different document.
Code:
Sub CopyAndPaste()
    Dim myfile, wdApp As New Word.Application, wdDoc As Word.Document
    'select truck report file
   ChDrive "E:\"
ChDir "E:\WG\TVAL\"
myfile = Application.GetOpenFilename(, , "Browse for Document")
    Dim i As Integer
   'searches for row with "avg" then selects column E(avg of temperature mean) of that row.
    i = Application.Match("Avg", Sheet1.Range("A1:A20"), 0)
    'copies the cell
    Range("E" & i).Select
    Selection.Copy
 
    wdApp.Visible = True
    Set wdDoc = wdApp.Documents.Open(myfile)
    'selects the paste range in the performance review table, depending on the set point
    If Range("c2") = 22 Then wdDoc.Bookmarks("d22").Select
    If Range("c2") = 5 Then wdDoc.Bookmarks("d5").Select
    If Range("c2") = -20 Then wdDoc.Bookmarks("d20").Select
 
    'and paste the clipboard contents
    wdApp.Selection.Collapse wdCollapseEnd
    wdApp.Selection.Paste
End Sub
My code is dependent on pasting to the bookmarks, as I need to paste into a specific cell within the table.



Does anyone know if applying bookmarks can be done universally? and if not, does anyone have a better solution to pasting into a table cell?
Here are my previous threads working on this problem:
https://www.mrexcel.com/forum/genera...ine-table.html
https://www.ozgrid.com/forum/forum/h...ile-within-vba
But if you could post solutions in this thread that would be great!
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Having Issues Applying a Macro Across Multiple Files. Changes Just Don't Seem To Save. Kajex Word VBA 2 09-08-2017 06:37 AM
Applying heading style to multiple pages at once jane.bugai Word 5 02-24-2017 04:05 PM
Applying bookmarks to multiple documents - is it possible? Form updating Bookmarks - writes to the bookmarks multiple times PeterPlys Word VBA 13 01-14-2015 06:41 AM
Applying bookmarks to multiple documents - is it possible? Applying a conditional format to multiple rows secoo140 Excel 1 10-12-2013 07:19 PM
Publisher 2000 - Applying multiple styles Jerb Publisher 0 02-15-2009 10:06 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:09 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