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

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

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -