Automatically load DOCMD(1312) on document creation from template

Started by Vikingdude, December 03, 2024, 11:11:35 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Vikingdude

Hi,

I have made a Template file, a simple frame with a titleblock.
The titleblock includes rectangles such as:
- Document Title
- Created by
- Date created

In the Document ShapeSheet I have prefilled the Shape Data with these variables.
"Prop.Document_title", "Prop.Created_by", "Prop.Date_created".

The title blocks have fields inserted -> "Custom Formula" -> "=TheDoc!Prop.Document_title"
If I change the values in the Document ShapeSheet, they automatically update. Great, everything is working.


This is where it becomes tricky;
Everytime I create a new document from the template file, I want to be prompted to fill in the Document Shape Data.
I tried using a user-defined cell in the document ShapeSheet;
"User.TriggerShapeData" Prompt: =IF(LEN(DIRECTORY())=0,DOCMD(1312),0)
Basically, the document checks if there is no save directory to the document on initialization, if not, it opens the DOCMD(1312) form.

The code is working and I do get the DOCMD(1312) form to appear, but NOT when creating a new file from the template. It seems that the "User.TriggerShapeData" initializes BEFORE the Shape Data is created, thus I get the error message on document creation "No shape data exists".

If I close the dialog box, head into the Document ShapeSheet, press the code and hit "Enter", it loads perfectly.


Is there any way I can delay the function to load AFTER the Shape Data has been defined on document creation?
I even tried to add the function under one of the Shape Data prompts, but I get the same error.

Thanks for all help!

Surrogate

We can call TheDoc's shape data window via DOCMD only when active some TheDoc ShapeSheet cell

Vikingdude

Quote from: Surrogate on December 03, 2024, 01:20:19 PMWe can call TheDoc's shape data window via DOCMD only when active some TheDoc ShapeSheet cell

Thanks for the reply, when you say "Active some TheDoC ShapeSheet cell" - could you help me narrow down my options? Is it possible to run a function that "calls/activates" the user-defined cell in TheDoc?

Surrogate

Quote from: Vikingdude on December 05, 2024, 07:24:55 AMIs it possible to run a function that "calls/activates" the user-defined cell in TheDoc?
I couldn't do it using the ShapeSheet.

One of my clients really wanted to call Shape Data window at document level (TheDoc). I did it via VBA-code:
1. Opened the document's ShapeSheet window
2. Made this window hidden
3. Activated one of the ShapeSheet cells
4. After these steps, the Shape Data window was called


I'll try find this old code.
Sub Call_TheDoc_ShapeData()
Dim wn As Window
Set wn = ActiveWindow.Document.DocumentSheet.OpenSheetWindow
wn.Visible = False
wn.Activate
Application.DoCmd (1312)
End Sub

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 214 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1060KB.
Tokens: post-login.
Cache hits: 14: 0.00243s for 26,543 bytes (show)
Cache misses: 4: (show)
Queries used: 17.

[Show Queries]