Link to home
Start Free TrialLog in
Avatar of fragen
fragen

asked on

start winword from access as normal user

I use the following code (see below) in MS Access97 to start a Winword Document97.
My problem is that i cannot do this as normal user. When i do the same as Administrator i have no problem.

When i try to start this funktion as normal user and after i pass the following line:
.Documents.Add Template:=Chr(34) & vorlage & Chr(34)
i will get the following error:

?err.Description
Macrospace could not be opened
?err.Number
 5981
?err.Source
Microsoft Word


I hope somebody can help me there.
Thanks a lot
fragen

----------------
Private Sub Button_Click()

Dim appWd As Word.Application
Dim WordDoc As Word.DOCUMENT
Dim vorlage As String
Dim Nix
Dim Anred, titelak, titelve As String
Dim zHd As String

Select Case Anrede
    Case 1
        Anred = "Herrn"
    Case 2
        Anred = "Frau"
    Case 3
        Anred = "Firma"
    Case 4
        Anred = "Famillie"
End Select

'If [Anrede] = 1 Then anred = "Herrn"
'If [Anrede] = 2 Then anred = "Frau"
'If [Anrede] = 3 Then anred = "Firma"
'If [Anrede] = 4 Then anred = "Famillie"

If DCount("[titelnr]", "titelabfrage", "[kunden_id]=form![kundennr] and
[akademisch]=-1") > 0 Then
titelak = DLookup("[titel]", "titelabfrage", "[kunden_id]=form![kundennr]
and [akademisch]=-1")
End If

If DCount("[titelnr]", "titelabfrage", "[kunden_id]=form![kundennr] and
[akademisch]=0") > 0 Then
titelve = DLookup("[titel]", "titelabfrage", "[kunden_id]=form![kundennr]
and [akademisch]=0")
End If

If [z hd2].Column(0) <> 1183 Then
    zHd = Trim("z.Hd. " & Trim([z hd2].Column(3) & " " & Trim([z
hd2].Column(4) & " " & Trim([z hd2].Column(2))) & " " & UCase([z
hd2].Column(1))))
Else
    zHd = ""
End If

Nix = Trim(Anred & " " & titelve) & _
vbCr & Trim(Trim(titelak & " " & [Vorname]) & " " & UCase([nam])) & vbCr & _
Trim(Trim([firmeart] & " " & [Firmelaut]) & vbCr & _
zHd) & vbCrLf & _
[Adresse] & vbCr & [abkürzung] & "-" & [PLZ] & "  " & UCase([Ort])


       vorlage = vorl.Column(0)


On Error Resume Next 'See if Word is running
   Set appWd = GetObject(, "Word.Application.8")
    If Err.Number <> 0 Then 'Word Not running
      Err.Clear   ' Clear Err object in case error occurred.
      'Create a new instance of Word
      Set appWd = CreateObject("Word.Application.8")
      'Create an instance of Word
    Else
        appWd.Activate
    End If


On Error GoTo btnWinWord_Error

    With appWd
        ' Vorlage als Dokument öffnen
        .Documents.Add Template:=Chr(34) & vorlage & Chr(34)

        .ActiveDocument.Bookmarks("Adresse").Select
        .Selection.InsertAfter Nz(Nix)

        .Selection.EndOf Unit:=wdParagraph, Extend:=wdMove

        ' Sichtbar setzen
        .Visible = True

        ' Maximieren
        .WindowState = wdwindowstatemaximize
'        .Quit
    End With



btnWinWord_Exit:
    Exit Sub

btnWinWord_Error:
    If Err.Number = 5941 Then
        Nix = MsgBox("Falsche WinWordVorlage (Textmarke fehlt)" & _
        vbCrLf & "Vorlage war : " & vorlage, _
        vbCritical, "WinWord Abbruch")
        appWd.Quit
        GoTo btnWinWord_Exit
    Else
        Nix = MsgBox("Allgemeiner Fehler bei WinWord-Aufruf" & _
        vbCrLf & "Fehler-Nr ist : " & Err.Number, _
        vbCritical, "WinWord Abbruch")
        appWd.Quit
        GoTo btnWinWord_Exit
    End If
End Sub
--------------------------
Avatar of n f
n f
Flag of United States of America image

fragen,

I'm not sure if this is the problem you are encountering, but see Microsoft's KnowledgeBase Article "INFO: Corrupt Normal.dot Causes Errors When Automating Word (Q247028)" at

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q247028

It really sounds like the template is (the .dot) is the source of the error.  If you are signed on as Administrator, does the application try to use a .dot from a different subdirectory from when you log on as a "normal" user?  I'd look to see if you have .dot files in more than one place, then try the steps in the article to fix all the .dot files that may be being called in your application.

Hi fragen,

It sounds more like user previleges problem in the operating system. Try to give the normal user full previleges in the working directory (where you lounch the application) and see if it works for you now. You might even need to give full acces in the %SYSTEM%\Temp directory as well (where %SYSTEM% should be the directory where you installed the operating system in).

HTH,

Nosterdamus
Avatar of fragen
fragen

ASKER

I have found two normal.dot files and renamed these to normal.bak.
C:\Programme\Microsoft Office\Office\normal.bak
C:\Programme\Microsoft Office\Vorlagen\normal.bak

Also i log in as Administrator and set the following directories free for others. I set the previleges for all to do everything.

C:\Programme\Microsoft Office\Office
C:\winnt\temp

When i log on as User again i cannot se the hand under these directories and i will get still the error:
General error when starting winword.
Error-nr is: 5981.

I use fat32 partition.
Maybe there is an other way to set the privileges?

I hope somebody can help me again.
fragen


Hi fragen,

In addition to the above mentioned directories, you should set full access control to the user in the working directory (e.g. c:\My documents\).

The working directory is usualy the directory where your application (*.DBM file or alike) is located.
If there are any other directories that you reffer to (e.g. you open the word document in another directory) then you should set full access there as well.

HTH,

Nosterdamus
Avatar of fragen

ASKER

The worddocuments are on my server f:\msdaten\word\vorlagen and the usere have there full access.

My access application (*.mdb) is in the directory c:\eigene dateien\access.

there i set with my administrator the directory free for all useres with all rights.

But the error will come again.
Hope somebody can help me again.
fragen

Avatar of fragen

ASKER

The worddocuments are on my server f:\msdaten\word\vorlagen and the usere have there full access.

My access application (*.mdb) is in the directory c:\eigene dateien\access.

there i set with my administrator the directory free for all useres with all rights.

But the error will come again.
Hope somebody can help me again.
fragen

Hi fragen,

Sorry, but I'm out of ideas now. If something will pop up, I'll post it here.

Hope that you solve your problem.

Nosterdamus
Hi,

Looks like a macro security problem,

Set the macro security to the lowest level in word, maby it will work then.

And btw, Look at mail merge in word i think there's an easier way to do what you want.

if you make a query in access that results the specific data you can bound a mailmerge (in word) to that query and then i think you'll have less problems (I suspect).

good luck fcco

Avatar of fragen

ASKER

Thanks a lot for your message.
but can you tell me where i can find the macro security in word?
I use office97 and could only find a ceckbox macro virus in the options. After deactivating this box i have still the same problem.

can you explain me a little more about mail merge. Maybe you can send me an example (word97 and access97) file or there is an example in the internet.

Thanks a lot
fragen
Hi,

Well the basic thing that mailmerge does is looking data up in a dbase like access and then import that data into word. Word then replaces text in the document with the data from the database.


here is an example how to make an mailmerge:

http://www.taltech.com/TALtech_web/support/bckb/Merge.htm

What you do is open a word document and the fill it with data from access. Mailmerge get's the data from access. With mailmerge you can select queries or tables from your access mdb. In your case you can make a form that constructs a SQl


 
Avatar of fragen

ASKER

ok. i know mailmerge. It works quite fine but i have still some questions.

I have created an mailmerge with winword97 and access97 over odbc.

When i login as normal user there is no odbc available. So which file must i copy from the administrator to all user or user to get also the odbc driver.

And secound i will need a solution where i can import the datas over mailmerge in a new winword document and no linked datas because when i change the contents of the table also the results of the fields will be changed.

Hope you can help me here again.
Thanks a lot
fragen
Hi,

The drivers normally are installed within windows 98, But most of the time you don't need them beacause office and word are both Office components, how do you get the data with ms-query???.

If you give me your mail adres i'll send you and example

fcco
Avatar of fragen

ASKER

I made a mailmerge over odbc connection.
I add the data i will need from msaccess into a table and then i will take it at once into work.

I prefer odbc before dde because it is quicker.
But the normal user have no access to odbc.

Hope you can tell me how i can also use odbc with a normal user.

my address is: haiflosse@gmx.net.

greets
fragen
Well does the normal user have the MS-Access ODBC driver, check this first, else i sugest a login script that installs it. (check config panel). What OS do the workstations have.

Is the mdb on a network drive, do the users have the right's to access the mdb.

Else i don't have an idea how to make it work.

Another thing you can do is use ADO, if you totally wan't to control everything at good speed. But you need  to know how to program it.

for more questions about ADO you can come to me, if i can connect to any SQL server can't be that hard to connect to an access DB, we'll Access is an microsoft product so you'll never know...............


I just thought of one thing,

following up your first question why your code won't work.

What normal.dot file do the users use, and what normal.dot file does the adminstrator use. Maby t'here's teh sollution to your problem

fcco
Avatar of fragen

ASKER

Hy!
Mailmerge is a nice idea but the same as i used because the real problem is the line:
.Documents.Add Template:=vorlage
I want create a new document from a Collecting main

There comes stell the following error in Access97:

err.Description
Macrospace could not be opened
?err.Number
5981
?err.Source
Microsoft Word

To your questions:
The user have all the same odbc drivers like the administrator.
the mdb is local on each computer (win2000 prof.) and connect to the main mdb on the server (win2000).

The user have full right to the local mdb and the mdb on the server.

the user and administrator use the same normal.dot on a drive on the server which everybody have full access.

I think it doesn't care which connection i will use because the problem is in open a new document form a Collecting main.

I hope somebody can help me here again.
fragen









Hi fragen,

I still think that it's a previlages problem.

Ask your sysadmin to check that the user's policy is the same as the Admin's, regarding the applications and/or directories and/or files involved.

BTW, for best flexibility regarding policy definition(s) in win2000 OS installation, it is recommended to work in a NTFS environment rather than FAT32.

HTH,

Nosterdamus
Avatar of fragen

ASKER

I am myself the network Admin.
I don't know what i should check.
It is no problem to convert to ntfs but i don't still not know which drives i must set.

Again:
The office97 is local installed:
C:\programme\Microsoft Office\Office
The mdb to use is also local:
c:\eigene dateien\access

The mdb with the datas is on the server
\\aqua-01\daten
the *.dot documents ar also on the server
\\aqua-01\daten\word\vorlagen

All these drives are fat32.

Can you tell me again what i must do know. Must i convert all these drives from fat32 to ntfs and which drives must i set which preveleges.

thanks a lot again
fragen
Avatar of fragen

ASKER

I am myself the network Admin.
I don't know what i should check.
It is no problem to convert to ntfs but i don't still not know which drives i must set.

Again:
The office97 is local installed:
C:\programme\Microsoft Office\Office
The mdb to use is also local:
c:\eigene dateien\access

The mdb with the datas is on the server
\\aqua-01\daten
the *.dot documents ar also on the server
\\aqua-01\daten\word\vorlagen

All these drives are fat32.

Can you tell me again what i must do know. Must i convert all these drives from fat32 to ntfs and which drives must i set which preveleges.

thanks a lot again
fragen
Hi fragen,

I don't know if it is still relevant, but you shoul assign (map) a drive letter to \\aqua-01\daten\word\vorlagen (e.g. k:), and when you are addressing a file, use the following convension:
k:\MyDocument.doc
and not:
\\aqua-01\daten\word\vorlagen\MyDocument.doc

Pleace note that you have to set the drive letter in all your user's computers...
This method can save you a lot of head ake.

HTH,

Nosterdamus

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
 - PAQ'd and pts removed
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
ASKER CERTIFIED SOLUTION
Avatar of Jgould
Jgould

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial