Open specific Publisher document if criteria is met

Muna

New member
Local time
Today, 18:11
Joined
Feb 4, 2014
Messages
6
The code below allows me to open a publisher document that is already merged to the current record. What I need is to allow the user to open the document according to the group they are reviewing. Any idea how to accomplish this?

For example:

IF Group = “A1” OR “B1” THEN OPEN AB_1.pub
IF Group = “A2” OR “B2” THEN OPEN AB_2.pub
IF Group = “A3” OR “B3” THEN OPEN AB_3.pub


Dim pubApp As Publisher.Application
Dim pubDoc As Publisher.Document
Set pubApp = New Publisher.Application
Set pubDoc = pubApp.Documents.Add.Application.Open("c:\Publisher\AB_1.pub)
pubDoc.ActiveWindow.Visible = True
 
Hello Muna, something funky like
Code:
Dim pubApp As Publisher.Application
Dim pubDoc As Publisher.Document

Set pubApp = New Publisher.Application
Set pubDoc = pubApp.Documents.Add.Application.Open([COLOR=Red][B]"C:\Publisher\AB_" & Right([Group], 1) & ".pub"[/B][/COLOR])
pubDoc.ActiveWindow.Visible = True
 
Thank you Paul for your quick response, unfortunately the name of the documents or groups are not as easy as my first example.

A better example:

[FONT=&quot]IF Group = “Active” OR “NRS” THEN OPEN c:\publisher\Current_6-12-24.pub
IF Group = “Inactive” OR “TRS” THEN OPEN [/FONT][FONT=&quot][FONT=&quot]c:\publisher\[/FONT]Contact_3.pub
IF Group = “Control” OR “PRS” THEN OPEN [/FONT][FONT=&quot][FONT=&quot]c:\publisher\[/FONT]Follow_3-6-9.pub[/FONT]
 
Now comes the truth.. :p
unfortunately the name of the documents or groups are not as easy as my first example.
In this case, I would suggest you create a new table with minimum of three fields.

tbl_DocList
docID (PK)
docDescription
docLocation

Sample Data
Code:
docID    docDescription    docLocation
1    Current Customer    C[FONT=&quot]:\publisher\Current_6-12-24.pub[/FONT]
2    Contacts            C[FONT=&quot]:\publisher\[/FONT][FONT=&quot][FONT=&quot]Contact_3[/FONT].pub[/FONT]
3    Control             C[FONT=&quot]:\publisher\something.pub[/FONT]
Then in your data table you can link them up. Or create a Junction table, with status.
 

Users who are viewing this thread

Back
Top Bottom