Different titleblock text on different pages

Started by Dusty_Rhodes, March 06, 2019, 10:16:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dusty_Rhodes

Hello,

I have a Titleblock placed on the background that i use a VBA userform to fill in. I was wondering if there is  a smart way to make the titleblock display different information depending on what page is active. Since my drawings usually are multipage documents, and most info in the titleblock needs to be different for each drawing page.   Anywhere from 1 to 10 fields may need to contain different information from page to page.

Surrogate

What kind of information you need placed in different pages ?

Hey Ken

Dusty:

   If I'm not missing something, here's a simple solution: Create a dedicated background page for each titleblock, and use that as the background for your different pages as required.  Then create a common background page for each dedicated titleblock background page (assuming there's a common background for all pages).  Since your VBA needs to update those 1 to 10 fields, you can find their page location by querying the foreground page's background page name, then directly update the fields on that page.

   Hope this helps,

   - Ken

Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

Dusty_Rhodes

Hello

Surrogate: the information is system name, who made the drawing, who checked the drawing, approved bt who, dates fo this and group.

Hey Ken: So you mean to create a titleblock and specific background page for every different system ?

Hey Ken


Dusty:

   Yep, there would be a different background page to hold each titleblock.  But since you're using VBA, it's not that difficult to create and maintain.  Again, assuming I understand what you're trying to do, here's how I'd set up the VBA:

1.   Assume a blank document to start, with only a blank foreground page and the common background page existing.
2.   Display your form from the foreground page where the titleblock should go, and let the user enter the titleblock info and click OK.
3.   If the titleblock background page does not exist for this foreground page (first time only), create it and hook your common background page behind it.  After that it's there forever.
4.   If the titleblock itself does not exist on the background page, create one (again, first time only) and it's there forever.  I'm assuming they all look the same, just with different info populating the 1-10 fields.
5.   Now that the background page and titleblock both exist, populate the fields from your form. 

   I'd use a common subroutine where you pass it the name of the background page, and it does all that form-ish magic.  If the block already exists, the form can be pre-populated with its contents so that the user can update things.

   Hope that's clear enough; hope it helps. 

   - Ken

Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

Dusty_Rhodes

#5
Ken:

I currently have my the shapes that make up my titleblock defined in VBA as there shape names. The VBA code looks like this

Set vsoShape = Application.ActiveDocument.Pages.ItemU("Background").Shapes("Name of the shape i want to fill with text")
      Me.RevisionTextBox.Value = vsoShape.Text

So i would then need to make a new background page for every new titleblock, and edit the name of the shapes so that it does not get filled with the inforamtion that should be in another titleblock ?

I would then need to be able to toggle the userform between what titleblock/background pages it should fill. Could this be done by having a drop down menu that changes the userform info for what page should be filled, like in the picture ?

Or is there maybe a easier way to do this that i am missing ? The code could maybe be written in a diffeerent way.

Yacine

Bad idea ...

Your dialog should write the data to a common and public place eg the doc.
Then each background shape can read by itself the data it needs eg thedoc!prop.created_by.
This way you can build a background template, then derive individually the specific ones. No need to address by code the individual shapes.

my 2 cents ;)
Yacine

Dusty_Rhodes

Hello

Yacine: "Your dialog should write the data to a common and public place eg the doc"

How do you mean that this should be executed in the code ? I dont follow

Yacine

#8
Setup of the prop field
1) manually in the shapesheet of the doc (drawing explorer)
2) VBA: activedocument.documentsheet.addnamedrow(vissectionprop, "x", vistagdefault)

Writing
1) in VBA
x = myInputField.value
activedocument.documentsheet.cells("prop.x").formulau = """ & x & """
2) from the shapesheet of any shape
setf(getref(thedoc!prop.x), 123)
Reading
1) in VBA:
y = activedocument.documentsheet.cells("prop.x").resultstr("")

2) in the shapesheet of any shape in the document:
y = thedoc!prop.x
Yacine