|
-
January 20th, 2000, 10:38 AM
#1
Saving a document in a temporary file
Is there a way in VB to save an open document in word so another program (called by the vb macro) can access it? I've tried saving the document twice in a row with different filenames like this:
ActiveDocument.SaveAs filename:="c:\temp\blah.doc"
ActiveDocument.SaveAs filename:="c:\temp\abcdef.doc"
But I still cannot access blah.doc. Any ideas why this is happening and how to get around it?
Thanks,
Karl Monaghan
-
January 20th, 2000, 11:47 AM
#2
Re: Saving a document in a temporary file
couldn't reproduce that behavior.
I tried this code with VB 6 and Office 2000 on an NT machine:
Dim x as Word.Application
set x = new Word.Application
x.Visible = true
x.Documents.Open "c:\test.txt"
x.ActiveDocument.SaveAs "c:\test.doc"
x.ActiveDocument.SaveAs "c:\test2.doc"
Dim hfile as Integer
hfile = FreeFile
Open "c:\test.doc" for input as #hfile
Dim strZeile as string
Line input #hfile, strZeile
Close hfile
x.ActiveDocument.Close
set x = nothing
no problem opening an reading from the file.
-
January 20th, 2000, 12:48 PM
#3
Re: Saving a document in a temporary file
Open "c:\whatever\whatever.doc" For Output As #1
s = Text1
Write #1, s
Close #1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|