Works on XP but not Vista

B

Bill

I am using Access 2003 and I have the following code that is supposed to open
a Word template for editing by the user.
________________________________________________
Dim strTemplate As String

' Late binding references to Word
Dim objWord As Object
Set objWord = CreateObject("Word.Application")
objWord.Visible = True

Dim objDoc As Object
' TemplatePath is a global variable containing the path to where the .dot
file is stored
strTemplate = TemplatePath & Me.cboLetterSelect.Column(3)
Set objDoc = objWord.Documents.Open(strTemplate)

' AppActivate lblTemplateName.Caption
' AppActivate objWord.Application.ActiveDocument.Name
objDoc.ActiveWindow.View.Type = 3 ' wdPrintView = 3

Set objWord = Nothing
Set objDoc = Nothing
______________________________________________

This code words fin in XP but when I run it on a Vista machine, the template
opens as a read-only document. I have tried to run it with each of the
AppActivate commands uncommented. Both work fin in XP but I get an error
message in Vista. Full Access is installed on the XP machine and just the
run-time on the Vista machine.

Anyone any ideas?
 
G

George Nicholson

Just a guess:
Program Files is probably where the Template is stored (in an Office or
Custom app subfolder). In Vista that folder & subfolders are very tightly
locked down and you can't write to those locations as easily as you could in
earlier versions. That's why it opens Read-Only: you don't have write
permissions.

Not sure what the best solution is. Probably avoid using ProgramFiles and
move Templates to a more friendly location...(C:\Users\Public\Documents...)?

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top