Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Tue, 24 May 2005 12:36:06 -0700,    group: microsoft.public.word.word97vba        back       


Access doc from web   
I know how to open a document from the web like so:

     Set doc1 = objWord.Documents.Open("http://my.site.com/path/to.doc")

My problem is I need a way to use this document in a method call that needs 
the filename in the form of a string.

Of course, the first thing I tried was putting in the entire URL as a string 
like in the Open call, but this particular method (.Merge or .Compare) 
doesn't seem to like the 'http://' reference.

I also tried referencing the document object that I already opened. If I use 
'doc1.FullName', it still throws the same error saying, "The document name or 
path is not valid". Is there a way to use the object that has already been 
opened? Maybe point to whereever the temporary file is being stored?

Any help would be GREATLY appreciated.

Chris


FYI. I'm trying to use either Word's '.Compare' or '.Merge' method to 
difference 2 documents from the web without saving them locally.
date: Tue, 24 May 2005 12:36:06 -0700   author:   daiei27

RE: Access doc from web   
Hi,

When a document is open you can use activedocument.merge or 
activedocument.compare. might help to solve the problem.

Activedocument represents the current document that is currently open.

Hope you found this helpful

Anand


-- 
"Who will guard the guards?"


"daiei27" wrote:

> I know how to open a document from the web like so:
> 
>      Set doc1 = objWord.Documents.Open("http://my.site.com/path/to.doc")
> 
> My problem is I need a way to use this document in a method call that needs 
> the filename in the form of a string.
> 
> Of course, the first thing I tried was putting in the entire URL as a string 
> like in the Open call, but this particular method (.Merge or .Compare) 
> doesn't seem to like the 'http://' reference.
> 
> I also tried referencing the document object that I already opened. If I use 
> 'doc1.FullName', it still throws the same error saying, "The document name or 
> path is not valid". Is there a way to use the object that has already been 
> opened? Maybe point to whereever the temporary file is being stored?
> 
> Any help would be GREATLY appreciated.
> 
> Chris
> 
> 
> FYI. I'm trying to use either Word's '.Compare' or '.Merge' method to 
> difference 2 documents from the web without saving them locally.
date: Tue, 24 May 2005 22:17:15 -0700   author:   Anand.V.V.N

RE: Access doc from web   
Unfortunately, that's not the problem.  I guess I should've included a code 
sample to clarify things.  I can open documents locally and use the .Merge 
method just fine.  I also don't have a problem opening documents over the 
web.  The problem is the method requires a filename parameter in the form of 
a string, and for some reason it doesn't seem to like anything starting with 
'http://'.  Here's some VBScript to illustrate:

----- Start -----
	'Open Word'
	Dim objWord
	Set objWord = CreateObject("Word.Application")
	objWord.Visible = True 'Make Word visible'
	
	'Open RTF files'
	Dim doc1, doc2
	Set doc1 = objWord.Documents.Open("http://my.site.com/path/one.doc")
	Set doc2 = objWord.Documents.Open("http://my.site.com/path/two.doc")

	'Create difference'
	'1 = current, 2 = new, 0 = selected'
	Const wdCompareTarget = 2
''	doc1.Merge "http://my.site.com/path/two.doc", , wdCompareTarget
''	doc1.Compare doc2.FullName, , wdCompareTarget
----- End -----

Both of the last two commented lines throw the same invalid doc name or path 
error.  I know filename parameter is the problem because I can use the 
..Content.InsertAfter method on doc1 and doc2 successfully.  Anyone know of 
another way to reference the documents???

Alternatively, I could paste the text in if there was a way to difference 
text instead of files.  But I don't know of any way to do that.
date: Wed, 25 May 2005 13:31:05 -0700   author:   daiei27

RE: Access doc from web   
Hi,

What you could do is create a local copy of the documents and compare it 
locally.

activedocument.Sentences.Count this property would give you the number of 
sentences in the document, create a loop to select each sentence and insert 
it into a new document, save it locally, do the same thing for the second 
document. NOw you can comapre the local copies and delete them once you have 
done with comparision.

Or othet wya woudl is assign the path to a variable, pass the variable 
instead of the file location. May be it would work.

Hope you find it useful
-- 
"Who will guard the guards?"


"daiei27" wrote:

> Unfortunately, that's not the problem.  I guess I should've included a code 
> sample to clarify things.  I can open documents locally and use the .Merge 
> method just fine.  I also don't have a problem opening documents over the 
> web.  The problem is the method requires a filename parameter in the form of 
> a string, and for some reason it doesn't seem to like anything starting with 
> 'http://'.  Here's some VBScript to illustrate:
> 
> ----- Start -----
> 	'Open Word'
> 	Dim objWord
> 	Set objWord = CreateObject("Word.Application")
> 	objWord.Visible = True 'Make Word visible'
> 	
> 	'Open RTF files'
> 	Dim doc1, doc2
> 	Set doc1 = objWord.Documents.Open("http://my.site.com/path/one.doc")
> 	Set doc2 = objWord.Documents.Open("http://my.site.com/path/two.doc")
> 
> 	'Create difference'
> 	'1 = current, 2 = new, 0 = selected'
> 	Const wdCompareTarget = 2
> ''	doc1.Merge "http://my.site.com/path/two.doc", , wdCompareTarget
> ''	doc1.Compare doc2.FullName, , wdCompareTarget
> ----- End -----
> 
> Both of the last two commented lines throw the same invalid doc name or path 
> error.  I know filename parameter is the problem because I can use the 
> .Content.InsertAfter method on doc1 and doc2 successfully.  Anyone know of 
> another way to reference the documents???
> 
> Alternatively, I could paste the text in if there was a way to difference 
> text instead of files.  But I don't know of any way to do that.
date: Wed, 25 May 2005 23:32:02 -0700   author:   Anand.V.V.N

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us