Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


WordDocument VBscript

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> WordDocument VBscript
  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 >>
 WordDocument VBscript - 4/8/2005 7:42:38 AM   
  rockocubs

 

Posts: 65
Score: 0
Joined: 4/8/2005
From:
Status: offline
I am currently opening a word document with vbscript from within HTMl. It works great but it open's minamized at the bottom with the start button, you have to click on it down there for the user to bring it up, i would like it to open up active over the webbrowser.
code:
<script type="text/vbscript">


Sub OpenDoc(strLocation)


Set objWord = CreateObject("Word.Application")
objWord.Visible = true
objWord.Documents.Open strLocation
objWord.WindowState = wdWindowStateMaximize


End Sub
</script>
<script language="JavaScript">
<!-- hide
function openTemplate(documentName)
{
OpenDoc(documentName);
}


// done hiding -->

</script>

body

<form>
<input type="button" onClick="openTemplate ('K:\Mydocuments\hi.doc')" value="Open Word Document">
</form>
 
 
Post #: 1
 
 Re: WordDocument VBscript - 4/8/2005 9:41:48 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Replace:

objWord.WindowState = wdWindowStateMaximize

with:

objWord.WindowState = objWord.WdWindowState.wdWindowStateMaximize

(in reply to rockocubs)
 
 
Post #: 2
 
 Re: WordDocument VBscript - 4/11/2005 1:07:54 AM   
  rockocubs

 

Posts: 65
Score: 0
Joined: 4/8/2005
From:
Status: offline
I replaced the code as sugested and i get the following error.

Object doesn't support this property or method 'objWord.WdWindowState'
code 0

(in reply to rockocubs)
 
 
Post #: 3
 
 Re: WordDocument VBscript - 4/11/2005 7:25:19 AM   
  rockocubs

 

Posts: 65
Score: 0
Joined: 4/8/2005
From:
Status: offline
I got this to work, turns out the probelm was only with the first time you open up the browser and got the activex warning and after you clicked ok your word document would be minamized, but if you closed it and it the button again it would open an active window with no activex warning. So i cloned the subroutine and added a close of word and set visible to false so the user wouldn't see this being done. Then open document again in second routine with visible be set to true and no close.

(in reply to rockocubs)
 
 
Post #: 4
 
 Re: WordDocument VBscript - 4/11/2005 7:28:45 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Glad you got it worked out.

I'm a baby to scripting in Word =)

(in reply to rockocubs)
 
 
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 >> WordDocument VBscript 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