|
-
Feb 22nd, 2000, 04:08 PM
#1
Thread Starter
Fanatic Member
I've been working on this Word2000 Add-In in VB6, and i came across something weird (I think, but then again it's only my first Add-In). The Add-In has a toolbarbutton that places the current document's full path in the footer. My problem is that it only works for the first document created. If you open another document or create a new one, then the button acts like it doesn't fire the click event. Can someone please help me urgently, since my deadline is today!
r0ach™
Don't forget to rate the post
-
Feb 22nd, 2000, 06:16 PM
#2
Sorry - I can't help you on your question but I was just wondering what these add-ins are and how yo came to be making one.
Cheers
Mafro
-
Feb 22nd, 2000, 06:26 PM
#3
Thread Starter
Fanatic Member
An Add-In is a VB (or VC++ or VBA) program (ActiveX DLL) that uses the object model of a host program (MSOffice2000) to extend the capabilities of that program. It's like completely customizing certain things a program does, or creating brand new things for the program.
r0ach™
Don't forget to rate the post
-
Feb 22nd, 2000, 06:53 PM
#4
Lively Member
Please post the code in the button's click event and we'll have a look...
-
Feb 22nd, 2000, 07:28 PM
#5
Thread Starter
Fanatic Member
I don't think it's the button's code. I think it's got something to do with instances. If I close the first document (Document1) then I get "Object required" errors, when I click it. But i'll post the code anyway:
Code:
Private Sub oFooterBtn_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean)
Set wDoc = Word.Documents(oApp.ActiveDocument)
wDoc.Sections.First.Footers(wdHeaderFooterPrimary).Range.Font.Name = "Tahoma"
wDoc.Sections.First.Footers(wdHeaderFooterPrimary).Range.Font.Size = 8
wDoc.Sections.First.Footers(wdHeaderFooterPrimary).Range.Text = ""
wDoc.Sections.First.Footers(wdHeaderFooterPrimary).Range.InsertBefore wDoc.FullName
Set wDoc = Nothing
End Sub
r0ach™
Don't forget to rate the post
-
Feb 22nd, 2000, 08:11 PM
#6
Lively Member
It looks like the problem is that Word thinks you still want to add the footer to the first document, as errors occur when it is closed.
Try putting a msgbox in the button's code to display the name of the ActiveDocument.
You said that "the button acts like it doesn't fire the click event" - putting a msgbox in will tell whether the event fire or not as well.
-
Feb 22nd, 2000, 09:31 PM
#7
Thread Starter
Fanatic Member
benski.
Thanks. My suspicions were right. The button does not fire the event in the other documents. On the first doc, I get my MsgBox, but not on any of the other docs (opened or new).
r0ach™
Don't forget to rate the post
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|