vba - inserting ini File into word with formatting -


i have small bit of vba code works , inserts file specific bookmark within word, i'm struggling format text file gets inserted, either use format of bookmark or use specify format on insert.

working code

    file_purchase_inv_def = harvdir + "\v1live" + "\purchase_invoices.def"      selection.range.insertfile filename:=(file_purchase_inv_def)          orng = activedocument.bookmarks("bk_puchase_invioces").range         orng.select         selection.range.insertfile filename:=(file_purchase_inv_def) 

the format i'm trying use "verdana" , font size "7" have tried formatting area of bookmark , below code.

not working example1

    file_purchase_inv_def = harvdir + "\v1live" + "\purchase_invoices.def"      selection.range.insertfile filename:=(file_purchase_inv_def)          orng = activedocument.bookmarks("bk_puchase_invioces").range         orng.select         selection.range.insertfile filename:=(file_purchase_inv_def)            .styles(normal).font                 .name = "verdana"                 .size = 7                   end  

not working example 2

file_purchase_inv_def = harvdir + "\v1live" + "\purchase_invoices.def"      selection.range.insertfile filename:=(file_purchase_inv_def)          orng = activedocument.bookmarks("bk_puchase_invioces").range         orng.select         selection.range.insertfile filename:=(file_purchase_inv_def)           selection.font.name = "verdana"           selection.font.size = 7 

this use formatting of bookmark , replace whatever text bookmark has:

dim fpath fpath = "c:\users\testuser\desktop\test.txt"  activedocument.bookmarks("bk_puchase_invioces").range.text = _    createobject("scripting.filesystemobject").opentextfile(fpath).readall() 

Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

html - Outlook 2010 Anchor (url/address/link) -