Is there anyway to have a sub procedure that is triggered by saving an MS Word document? Thanks!
Is there anyway to have a sub procedure that is triggered by saving an MS Word document? Thanks!
In a standard module:
[VBA]Sub FileSave()
MsgBox "Your message Here."
End Sub[/VBA]
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
Thanks a lot lucas! That's great, is there any way I can stop it appearing in the macro box? Because:Originally Posted by lucas
[VBA]Option Private Module[/VBA]
doesn't work?
Not that I am aware of....I tried several things including adding it to thisdocument to no avail. Maybe Gerry or one of the regular Word guys will have an idea.
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
Okay, thanks a lot for your help lucas! I'll leave this thread open a while and see if anyone replies!Originally Posted by lucas
The Word.Application object exposes a DocumentBeforeSave event
that you could use. You will need to implement a class to get at it,
though.
Go to the VB Editor, and in the help search on Application Events for
an article on how to expose those events in VBA.
Regards,
Patrick
I wept for myself because I had no PivotTable.
Then I met a man who had no AutoFilter.
Microsoft MVP for Excel, 2007 & 2008
Or, you could also disable getting the macros dialog box.
Sub ToolsMacro()
' do nothing
' disables Tools > Macro > macros
' AND Alt-F8
End Sub
Thanks guys! I've ended up with a template! However, when I try to use it as a template I find that the macros don't seem to work! That is when I open it I still get the enable macro's warning, but the combo boxes aren't being populated! What is the problem?
As this has nothing to do with what you started the thread with, how are we to really know? Youy never mentioned it. A good place to start is to post what your code is to populate. Also, be specific with terms like "open" and "use".
Does that mean, specifically, you cloned a new document with File > New (the way to "use" templates) and when the new document is "opened" the combobox does not populate?
None of which has anything to do with saving the file - the topic you posted for the thread.
That is what I mean. Any ideas why that is?Originally Posted by fumei
I know! I just thought I'd tag it on the end in case anyone had any ideas instead of starting I new thread. But I'm happy to start a new thread if that would be better!Originally Posted by fumei
No, as you did not bother to post any code. Nope sorry....haven't a clue. It is hard to have idea when I have NO idea what you are currently doing.
Okay I've attached a document which was based on the template. Can you see what the problem may be now?Originally Posted by fumei
Okay that didn't work! Here it is again!!Originally Posted by icthus123
you need to post the pprTemplate.dot
There is no code in the doc file you posted.
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
I tried to post that but this website won't upload .dot files for some reason! but I think the code is there under Project (PPRTemplate) > Microsoft Word Objects > ThisDocument, or it is when I open the link anyway!Originally Posted by lucas
No code in the document you posted. Try zipping the .dot file and post it.
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
Okay, here it is!! I don't know why I didn't think of that!Originally Posted by lucas
I find comboboxes referenced but I don't see them...
[VBA]cboNIC.AddItem arrAll[/VBA]
no comboboxes in the files you have posted.
Question: Are you trying to populate specific places in the sheet using document properties? Why not use bookmarks?
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
I have to leave for a while so be patient. I also see no userform in either of the documents you posted.
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
okay thanks, there isn't any userform. The combo boxes are on the page and the borders are hid. The combo boxes are on the first page where it says no.Originally Posted by lucas