Hello everybody
I've got a strange problem with Access 2010 32-Bit SP1 on a Citrix Server.
I have a small procedure that opens Word and should create a new document.
Here you can see the code:
Code:
Dim objWord As Object
Dim objDoc As Object
Dim rng As Object
vFile = "P:\Adressen\Vorlagen\Brief.dotx"
Set objWord = CreateObject("word.application")
'objWord.Visible = True
Set objDoc = objWord.Documents.Add(Template:=vFile)
If objDoc.Bookmarks.exists("bAnschriftStandard1") = True Then
Set rng = objDoc.Bookmarks("bAnschriftStandard1").Range
rng.Text = "Test"
End If
Set objWord = Nothing
End Sub
First of all: on four local installations it works perfectly. The problem only occurs on Citrix (the same Office version as local).
If line 7 is inactive, I get an error in line 9:
"4248, The command is not available, because no document has been opened" (or something like that, I've got only the German version
)
In a German forum I've got the hint with line 7. So if I activate it, sometimes it works, but sometimes it doesn't and then another error appears in line 8:
"424, Object needed"
The most strange thing here is, that every time I go through my procedure step by step with F8 it works fine. Only if I start the procedure by clicking the button in the form it doesn't work.
Has anybody an idea what the problem could be?
Thank you very much!
Daniel