Webmaster Forum

Go Back   Webmaster Forum > Scripting/Programming & Debugging > ASP & VBScript Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

ASP & VBScript Forum Need help from a webmaster with ASP or VBScript, you may ask in this forum?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-26-2007, 10:14 PM
w0mbat w0mbat is offline
Junior Member
 
Join Date: Nov 2007
Posts: 1
w0mbat is an unknown quantity at this point
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq Submit to Spurl
Question Newbie help



I am trying to bold a certain word in a document using this script:

Const wdReplaceAll = 2

Set objWord = CreateObject("Word.Application")
objWord.Visible = True

Set objDoc = objWord.Documents.Open("C:\Scripts\Test.doc")
Set objSelection = objWord.Selection

objSelection.Find.Text = "<%>"
objSelection.Find.Forward = True
objSelection.Find.MatchWholeWord = False

objSelection.Find.Replacement.Font.Bold = True

objSelection.Find.Execute , , , , , , , , , , wdReplaceAll

Sub Bold_Text_in_Doc()

End Sub

When I got to run it I get the error on the word "Set" in Set objWord = CreateObject("Word.Application"):

Compile error - Invalid outside procedure

Does anyone know why?

Thanks
w0mbat
Reply With Quote

This ad is part of our Revenue Sharing program
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
setTimeout in loop (newbie) dbworm JavaScript & AJAX Forum 4 12-12-2006 09:05 AM


All times are GMT. The time now is 03:53 AM.


Creative Commons License
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.0.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30