Solved

start winword from access as normal user

Posted on 2002-04-29
22
454 Views
Last Modified: 2012-06-27
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
--------------------------
0
Comment
Question by:fragen
  • 9
  • 5
  • 5
  • +3
22 Comments
 
LVL 1

Expert Comment

by:n f
ID: 6978803
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.

0
 
LVL 7

Expert Comment

by:Nosterdamus
ID: 6979663
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
0
 

Author Comment

by:fragen
ID: 6980336
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


0
 
LVL 7

Expert Comment

by:Nosterdamus
ID: 6980548
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
0
 

Author Comment

by:fragen
ID: 6980644
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

0
 

Author Comment

by:fragen
ID: 6980725
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

0
 
LVL 7

Expert Comment

by:Nosterdamus
ID: 6982751
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
0
 
LVL 2

Expert Comment

by:fcco
ID: 6988285
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

0
 

Author Comment

by:fragen
ID: 6991798
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
0
 
LVL 2

Expert Comment

by:fcco
ID: 7001987
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


 
0
 

Author Comment

by:fragen
ID: 7004619
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
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 2

Expert Comment

by:fcco
ID: 7004672
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
0
 

Author Comment

by:fragen
ID: 7004943
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
0
 
LVL 2

Expert Comment

by:fcco
ID: 7006658
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...............


0
 
LVL 2

Expert Comment

by:fcco
ID: 7006674
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
0
 

Author Comment

by:fragen
ID: 7008588
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









0
 
LVL 7

Expert Comment

by:Nosterdamus
ID: 7008783
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
0
 

Author Comment

by:fragen
ID: 7008828
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
0
 

Author Comment

by:fragen
ID: 7009237
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
0
 
LVL 7

Expert Comment

by:Nosterdamus
ID: 7087605
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
0
 
LVL 54

Expert Comment

by:nico5038
ID: 7212392

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)
0
 

Accepted Solution

by:
Jgould earned 0 total points
ID: 7236396
moved to PAQ and points not refunded as per recommendation

JGould-EE Moderator
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now