Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


How to access a word document without opening the application

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,61593
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> How to access a word document without opening the application
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 How to access a word document without opening the appli... - 6/18/2008 4:01:13 PM   
  chaya

 

Posts: 12
Score: 0
Joined: 6/16/2008
Status: offline
Hi All,

Iam trying to access a file properties for a word document. I need to open the document without opening the word application.
I have been unsuccessful trying this :

Dim appWord As Word.Application
Dim wrdDoc As Word.Document
Set appWord = New Word.Application
Set wrdDoc = appWord.Documents.Open("D:\Test.doc")

Gives an error "Expected end of statement" at line 1

Please guide me

thank you!
 
 
Post #: 1
 
 RE: How to access a word document without opening the a... - 6/18/2008 8:27:14 PM   
  ehvbs

 

Posts: 2201
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi chaya,

VBScript isn't VBA. You can't specify the datatype of a variable with a AS clause. So
start with:

Dim appWord
Dim wrdDoc
Set appWord = CreateObject( "Word.Application" )
Set wrdDoc = appWord.Documents.Open("D:\Test.doc")

Good luck!

ehvbs

(in reply to chaya)
 
 
Post #: 2
 
 RE: How to access a word document without opening the a... - 6/18/2008 9:36:17 PM   
  chaya

 

Posts: 12
Score: 0
Joined: 6/16/2008
Status: offline
Thank you!

But using CreateObject will start the Word Application? 
Is it not possible to access the file properties without using Open with createObject or getobject?
I would like to avoid starting of the word application admidst the script execution

(in reply to ehvbs)
 
 
Post #: 3
 
 RE: How to access a word document without opening the a... - 6/18/2008 11:33:31 PM   
  ehvbs

 

Posts: 2201
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi chaya,

you can't avoid to start Word, if you want it to work for you. Maybe you can hide
the Word window by doing something like:

   appWord.Visible = False

(I don't use Word, so this extrapolation from Excel is probably wrong; check the
Word Docs)

Good luck!

ehvbs

(in reply to chaya)
 
 
Post #: 4
 
 RE: How to access a word document without opening the a... - 6/19/2008 2:52:48 PM   
  chaya

 

Posts: 12
Score: 0
Joined: 6/16/2008
Status: offline
 
Thats useful info.
Thank u once again!

(in reply to ehvbs)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> How to access a word document without opening the application Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts