![]() |
#1
|
||||
|
||||
![]()
I am working on a Userform that gathers information to be placed onto an already design layout. What I am gathering in this userform is the information like Proof No., Job Summary Description, Filename, Contact Person, Contact Company, Phone, Fax and Email. This information is then placed into the Proof Form sheet so I can them make a PDF file and email to the client.
If I might add to this situation I have a checkbox in the userform that asks if there are additional pages to the document being created. If that checkbox is checked then on my document I have a red check mark appear and print when the PDF is created. Here are just a few samples of the Userform field names. txtProofNo, txtJobSummary, txtFilename, etc. Here are my questions: 1) How do I get the userform txtXXXX fields into the document layout? 2) How do I get the checkbox on the userform for additional pages to make a check mark appear (already a layer by itself on the document) and print? 3) On one of the fields I have as a combolistbox how would I get a list of the open files for one of them to be selected in this combolistbox? Thanks for any comments or directions to finding an answer. |
#2
|
||||
|
||||
![]()
1) How do I get the userform txtXXXX fields into the document layout?
You can create the text like this: Code:
ActiveLayer.CreateArtisticText 0, 0, TextBox1.Text, , , "Arial", 12 Code:
If CheckBox1.Value Then ActivePage.Layers("MyCheckBox").Visible Code:
Private Sub UserForm_Initialize() Dim doc As Document For Each doc In Application.documents ComboBox1.AddItem doc.Name Next doc End Sub -Shelby |
#3
|
||||
|
||||
![]()
Thanks Shelby! It did point me in the right direction now I have an issue with a checkbox that I am trying to figure how to handle.
What I am trying to accomplish here is if the 'Additional Page' layer is visible then when the userform is initialized the Additional Page checkbox is checked and vice versus. It works, kind of, when I make sure the layer is not visible initially. Code:
Private Sub chkAddlPgs_Click() If chkAddlPgs.Value = False Then ActivePage.Layer("Additional Page").Visible ActivePage.Layer("Additional Page").Printable End If End Sub Private Sub UserForm_Initialize() Dim doc As Document For Each doc In Application.Documents cmbFilename.AddItem doc.FilePath & doc.FileName Next doc 'check if Additional Page layer is active ActivePage.Layers("Additional Page").Activate If ActiveLayer.Visible Then chkAddlPgs.Value = True Else chkAddlPgs.Value = False End If ActivePage.Layers("Proof Info").Activate End Sub |
#4
|
||||
|
||||
![]()
Since both values, the checkbox and Layer Visible are Boolean, you can simplify this by just setting them equal to each other.
As for your chkAddlePags_Click event, you forgot the s on Layers, and then need to set them equal to a value, again I would just set them equal to the checkbox value. Code:
Private Sub chkAddlPgs_Click() ActivePage.Layers("Additional Page").Visible = chkAddlPgs.Value ActivePage.Layers("Additional Page").Printable = chkAddlPgs.Value End Sub Private Sub UserForm_Initialize() Dim doc As Document For Each doc In Application.documents cmbFilename.AddItem doc.FilePath & doc.FileName Next doc 'check if Additional Page layer is active chkAddlPgs.Value = ActivePage.Layers("Additional Page").Visible ActivePage.Layers("Proof Info").Activate End Sub |
#5
|
||||
|
||||
![]()
Thanks Shelby!!
![]() |
#6
|
||||
|
||||
![]()
What do I need to do to stop this from "pasting" outside of my document area? It works correctly on the first attempt but repositions after that. Any ideas? I can upload the GMS file and document if need be.
*edit* Okay just reopened from the start and it does it initially. Sorry unable to upload document as it is 19MB. So if anyone that is willing to look at this I cam PM you the file and GMS let me know. *edit again* DOH!!! somehow the page alignment was off. So I double clicked the spot in the upper left corner of the two rulers and viola it works now. The question now would be how do I get this from not happening again. Like what is the code to use to make sure the lower left corner of the document is the 0,0 position. Code:
Private Sub cmdOk_Click() 'Ok button was clicked now do the following ActiveWindow.ActiveView.ToFitPage curDate = Format(Date, "Mmmm dd, yyyy") 'check if any box is empty of information 'fill the proof sheet with info provided ActivePage.Layers("Proof Info").Activate ActiveLayer.Shapes.All.Delete With ActiveLayer .CreateArtisticText 0.71488, 9.22521, txtProofNo.Text, , , "Swis721 BT", 9 .CreateArtisticText 1.20034, 9.22419, curDate, , , "Swis721 BT", 9 .CreateParagraphText 0.37646, 9.16376, 4.55017, 8.82941, txtJobSummary.Text, , , "Swis721 BT", 9 End With If chkGeneric.Value = True Then txtFilename.Text = txtFilename.Text Else txtFilename.Text = cmbFilename.Text End If ActiveLayer.CreateArtisticText 0.7325, 8.68987, txtFilename.Text, , , "Swis721 BT", 7 'Shapes.All.ApplyFill CreateRGBColor(255, 255, 255) 'switch layers delete shapes and post new info ActivePage.Layers("Proof Area").Activate ActiveLayer.Shapes.All.Delete With ActiveLayer .CreateArtisticText 0.71068, 8.40261, txtContact.Text, , , "Swis721 BT", 9 .CreateArtisticText 4.67731, 8.40507, txtBusiness.Text, , , "Swis721 BT", 9 .CreateArtisticText 0.65028, 8.21527, txtPhone.Text, , , "Swis721 BT", 9 .CreateArtisticText 2.86788, 8.21527, txtFax.Text, , , "Swis721 BT", 9 .CreateArtisticText 5.28394, 8.21527, txtEmail.Text, , , "Swis721 BT", 9 End With Unload Me End Sub Last edited by byteme67; 29-05-2012 at 13:05. |
#7
|
||||
|
||||
![]()
Okay posting to myself again. LOL After reading the help and locating something about DocumentOriginX = x I think this is the way to go.
But I am trying to reposition the Origin so that it is in the lower left corner. In the help it has this: Code:
Dim d As Document Set d = ActiveDocument . . . d.DrawingOriginX = -d.ActivePage.SizeWidth / 2 d.DrawingOriginY = -d.ActivePage.SizeHeight / 2 Code:
ActiveDocument.DrawingOriginX = -ActiveDocument.ActivePage.SizeHeight / 2 ActiveDocument.DrawingOriginY = -ActiveDocument.ActivePage.SizeWidth / 2 ![]() |
#8
|
|||
|
|||
![]()
The tricky thing about checking your code is that most of it is based around your form which is not available to us.
One option is to provide the GMS file, another is to separate your code from your form. By which I mean - make a separate subroutine, like this: Code:
Sub PlaceText(ByVal Text1 As String, ByVal Text2 As String, ByVal Text3 As String) With ActiveLayer .CreateArtisticText 0.71488, 9.22521, Text1, , , "Swis721 BT", 9 .CreateArtisticText 0.71488, 9.22521, Text2, , , "Swis721 BT", 9 .CreateArtisticText 0.71488, 9.22521, Text3, , , "Swis721 BT", 9 End With End Sub Code:
Sub ButtonSomething() PlaceText TextBox1.Value, TextBox2.Value, TextBox3.Value End Sub Code:
Sub ButtonSomething() PlaceText "A","B","C" End Sub Also speaking of reusability having hardcoded values in your sub is an easy way to problems. I would do it somewhat like this, for example: Code:
Sub Example() Dim X As Double, Y As Double, LineHeight As Double, FontSize as Byte X = ActivePage.LeftX Y = ActivePage.BottomY LineHeight = 0.3 FontSize = 9 With ActiveLayer .CreateArtisticText X, Y, Text1, , , "Swis721 BT", FontSize .CreateArtisticText X, Y + LineHeight, Text2, , , "Swis721 BT", FontSize .CreateArtisticText X, Y + LineHeight * 2, Text3, , , "Swis721 BT", FontSize End With End Sub These are just general suggestions, but I hope they can help you a bit. |
#9
|
||||
|
||||
![]()
Hey there Joe thanks for the input. I will look into what you mentioned. In the mean time I have attached the GMS file. I believe because I have a userform they are Private Sub's. And it is detached from the local document.
The actual document is 19MB which I cannot upload because of the size. But if you wanted to look at it PM me and I can email it to you. Or use one of those storage web sites in the interim. Thanks again! |
![]() |
Tags |
combobox, input to document, userform |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Userform control default value | noj | CorelDRAW/Corel DESIGNER VBA | 5 | 08-02-2012 12:44 |
Window Less UserForm | Adrian_Juman | CorelDRAW/Corel DESIGNER VBA | 2 | 09-04-2011 11:18 |
Userform | norbert_ds | CorelDRAW/Corel DESIGNER VBA | 8 | 14-01-2008 12:39 |
How to print to pdf file with imposition layout | samhoods | General | 1 | 09-04-2006 00:45 |
Where does Imposition layout save itself | samhoods | General | 1 | 29-03-2006 09:53 |