Home > Archive > Visual Basic > February 2005 > word
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| i am opening a word doc from vb
I want to open a new document not one that already exists.
Also when i open a document i get an error message saying it is locked by
another user(my own computer) and i must view in readonly mode.
How can i change it so that i can open a new word doc nd not have that error
come up??
Here's my code
doc = App.Path & "\Doc1.doc"
Set objWordApp = CreateObject("Word.Application")
objWordApp.Documents.Open doc
objWordApp.ActiveDocument.UpdateStylesOnOpen = False
| |
| Jan Hyde 2005-02-28, 3:55 pm |
| "sarah" <sarah@discussions.microsoft.com>'s wild thoughts
were released on Mon, 28 Feb 2005 03:27:01 -0800 bearing the
following fruit:
>i am opening a word doc from vb
>I want to open a new document not one that already exists.
>Also when i open a document i get an error message saying it is locked by
>another user(my own computer) and i must view in readonly mode.
>How can i change it so that i can open a new word doc nd not have that error
>come up??
>Here's my code
>
>doc = App.Path & "\Doc1.doc"
>
>Set objWordApp = CreateObject("Word.Application")
>objWordApp.Documents.Open doc
objWordApp.Documents.Add
>objWordApp.ActiveDocument.UpdateStylesOnOpen = False
J
Jan Hyde (VB MVP)
--
Three o'clock is always too late or too early
for anything you want to do.
Jean-Paul Sartre
[Abolish the TV Licence - http://www.tvlicensing.biz/]
| |
| Norman Yuan 2005-02-28, 3:55 pm |
| Addtion to Jan's reply:
As for the error, how do you finish with the objWordApp? Is it visible when
your code is running? It is possible that if your code run into error, an
instance of Word is left in memory with a document open. So when you try to
run the code again, you get that error message. Go to Task Manager to check
whether there is a Word running or not when you get that error.
"Jan Hyde" <StellaDrinker@REMOVE.ME.uboot.com> wrote in message
news:ag4621l5nmcdp13soi10mnvdt6h3vglipf@
4ax.com...
> "sarah" <sarah@discussions.microsoft.com>'s wild thoughts
> were released on Mon, 28 Feb 2005 03:27:01 -0800 bearing the
> following fruit:
>
error[color=darkred]
>
> objWordApp.Documents.Add
>
>
> J
>
> Jan Hyde (VB MVP)
>
> --
> Three o'clock is always too late or too early
> for anything you want to do.
>
> Jean-Paul Sartre
>
> [Abolish the TV Licence - http://www.tvlicensing.biz/]
>
|
|
|
|
|