![]() |
#1
|
|||
|
|||
![]() Is it possibly to get some kind of pop-up when you open a document? The thing is that I want to have the opportunity to deside if I should go with sidefoot a or b. (Word 2007 and Excel 2007) Last edited by KenZu; 03-05-2012 at 11:59 PM. |
#2
|
||||
|
||||
![]()
Yes, it is possible to get a pop-up, but I have no idea what you mean by a 'sidefoot'.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Lol, my bad english, I meant footer
![]() Is there any guide or something? |
#4
|
||||
|
||||
![]()
Why on earth would you want a macro for this, when you can access the footer at any time just by double-clicking on the header area and scrolling down?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]()
We are using like 100 documents and would like to change it depend on which office we're using.
So we need a macro, so we do not forget. |
#6
|
||||
|
||||
![]()
OK, if you add the following code to the Normal template's 'ThisDocument' module, you should get the desired prompt:
Code:
Option Explicit Private Sub Document_New() Call Document_Open End Sub Private Sub Document_Open() If MsgBox("Go to Footer?", vbYesNo, "Destination Selector") = vbYes Then ActiveWindow.ActivePane.View.SeekView = wdSeekPrimaryFooter End If End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
![]()
Thanks for the answer.
But to make it more complicate. When I open xxx.dot I want to get something like a roll-list or button said, "Gothenburg", "Stockholm" "Malmö" aso. And when i push/choose Gothenburg the footer will change automatic. |
#8
|
||||
|
||||
![]()
If you have three different offices (Gothenburg, Stockholm, Malmö), surely it would be better to have the templates for each location contain the relevant city name. That way, no-one needs to select anything.
Aside from that, I need to know whether the prompt is supposed to appear every time a document is opened, or only when you create a new one.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
![]()
It should appear everytime a template is opened.
For exampel. If you choose Gothenburg, the footer will change to: " Gothenburg AB, Tel 010-123456, www.gothenburg.com " |
#10
|
||||
|
||||
![]()
Hi Ken,
Try the following code: Code:
Private Sub Document_New() Call Document_Open End Sub Private Sub Document_Open() Application.ScreenUpdating = False Dim Rng As Range, Str As String, Fld As Field, i As Long i = CLng(InputBox("Which Office?" & vbCr & "1: Gothenburg, 2: Stockholm, 3: Malmö")) If i = 0 Or i > 3 Then Exit Sub With ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary) Set Rng = .Range.Characters.First Rng.Collapse wdCollapseStart For Each Fld In .Range.Fields With Fld If .Type = wdFieldQuote Then Set Rng = Fld.Result .Delete Exit For End If End With Next Select Case i Case 1 Str = "Gothenburg AB, Tel 010-123456, www.gothenburg.com" Case 2 Str = "Stockholm AB, Tel 010-123456, www.stockholm.com" Case 3 Str = "Malmö AB, Tel 010-123456,www.malmö.com" End Select Set Fld = ActiveDocument.Fields.Add(Range:=Rng, Type:=wdFieldQuote, _ Text:="""" & Str & """", PreserveFormatting:=False) End With Set Fld = Nothing: Set Rng = Nothing Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
rvessio | Word VBA | 4 | 07-25-2016 12:37 PM |
![]() |
schwine | Excel | 1 | 04-09-2011 11:23 PM |
How to choose scale effect for Formatting Palette? | schwine | Word | 0 | 04-02-2011 09:11 AM |
Choose Folder for GMail or Pop3 account to go to | datagopher | Outlook | 1 | 10-14-2010 10:55 AM |
Unable to choose Address books | Hyneso | Outlook | 0 | 08-11-2010 03:39 PM |