msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Connecting an ole-object to Word from Access

 
Post new topic   Reply to topic    msvisual.com Forum Index -> DirectX
Author Message
Hans Kristian Eide



Joined: 04 Oct 2007
Posts: 1

PostPosted: Wed Jul 04, 2007 6:16 pm    Post subject: Connecting an ole-object to Word from Access Reply with quote

I have made a code that works fine with me running Office 2003, but crash in
the customers setup running Office 2000 and only RunTime Access 2000. What do
I need to change?

Private Sub Journal_DblClick(Cancel As Integer)
With Me!Journal

.Enabled = True
.Locked = False
.Class = "Word.Application"
.Verb = acOLEVerbOpen
.Action = acOLEActivate
End With
InsertField

Feil:

End Sub

Private Sub btnNewJournal_Click()
'On Error GoTo wordfeil

Me!Journal.SetFocus

With Me!Journal
.Enabled = True
.Locked = False
If .OLEType acOLENone Then
MsgBox "There is already a journal."
GoTo slutt
End If

.Class = "Word.Application"
'.OLETypeAllowed = acOLEEmbedded
'.SourceDoc = vPath & "\NyJournal.doc"
.Verb = acOLEVerbOpen
.Action = acOLECreateEmbed
.Action = acOLEActivate
End With
InsertField

slutt:
Exit Sub

wordfeil:
MsgBox Err.Number & vbCr & Err.Description
Exit Sub
End Sub

Public Function InsertBookmark(vBook, vTekst As String)
On Error GoTo Err_InsertBookmark
With Me!Journal
.Object.Application.Selection.GoTo what:=wdGoToBookmark, Name:=vBook
.Object.Application.Selection.TypeText Text:=vTekst
End With
Exit Function
Err_InsertBookmark:
If Err = 5101 Then 'No bookmark
MsgBox "No bookmark"

Else
MsgBox Err.Description
End If
Exit Function
End Function

Private Sub InsertField()
Dim x
On Error GoTo feilfelt
x = InsertBookmark("Kategori", "JOURNAL" & vbCrLf & UCase(Kategori))
x = InsertBookmark("Navn", Nz(Fornavn & " " & Etternavn, ""))
x = InsertBookmark("Adresse", Nz(Adresse, ""))
x = InsertBookmark("Født", Nz(Fødselsdato, ""))
x = InsertBookmark("Postnr", Nz(Postnummer, ""))
x = InsertBookmark("Poststed", Nz(Poststed, ""))
x = InsertBookmark("Sivilstand", Nz(Sivilstand, ""))
x = InsertBookmark("Pårørende", Nz(Pårørende, ""))
x = InsertBookmark("TlfPriv", Nz(TelefonPriv, ""))
x = InsertBookmark("TlfJobb", Nz(TelefonJobb, ""))
x = InsertBookmark("TlfMob", Nz(TelefonMobil, ""))
x = InsertBookmark("FastLege", Nz(LegeFast, ""))
x = InsertBookmark("TlfLege", Nz(TelefonLege, ""))
x = InsertBookmark("Anmerkninger", "Spesielle anmerkninger: " &
Anmerkninger & vbCrLf & vbCrLf)
x = InsertBookmark("Start", "")
Me!Journal.Object.Application.ActiveWindow.ActivePane.LargeScroll Down:=-2
feilfelt:
Exit Sub
End Sub

Thank you for all help!

Archived from group: microsoft>public>vb>directx
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    msvisual.com Forum Index -> DirectX All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group