Copying Multipage1 to Multipage2

W

WLMPilot

I am setting up userforms on different multipages and I have some questions
since two things I want to accomplish involve the same userform for different
functions.

SETUP:
Multipage1 = userform to enter data.
Multipage2 = userform, that looks just like multipage1 userform, except it
will read
data in from spreadsheet for purpose of editing.

With this is mind, I am only going to create Multipage2 if there is a way to
copy multipage1 to multipage2.

Is this possible? If not possible, please help out with answering
questions below.

Since I am unable to copy userform to multipage2, I am going to need to
capture information from a spreadsheet, ie which commandbutton was clicked
(ENTER INFO, or EDIT info) and pass from the commandbutton 1 or 2 into the
userform initialization so that I can determine which way to go.

How can I do this?
 
J

JLGWhiz

I just created two userforms and put a multipage on form1. I then copied it
to form 2, so it looks like they can be copied. I also copied it on the same
form.
According to all that I have read in the past, you can also copy the entire
UserForm from one workbook to another and it takes the underlying code with
it. The easiest way to find out these things is to try it. If it does not
work, then check in with the group to find out who knows why.
 
W

WLMPilot

You indicate copying from workbook to workbook. I am stayting within the
same object (if that is the correct word). I created a userform with
multipage tabbing. I would like to have page2 be a mirror image of page1,
except I will use completely different coding since page2 will deal with
EDITING what has already be entered via page1. I was able to copy from page1
to page 2, taking the same code, or should I say that the fields referenced
the code already written.

Les
 
J

JLGWhiz

For the MultiPage itself, you cannot copy page 1 to page 2 as you would a
worksheet. You can copy each control (Text box, label, button, etc.) that is
on page 1, individually, to page 2 or other if you add more pages. Contrary
to what I previously said about the underlying code going with the control
when copied, the test I ran did not bear that out. VBA does automatically
increment the control name/number for you so that there is no confusion about
which one is which. It did not attach the click event code that was
underlying the control on pages(0). If you copy label1 from pages(0) to
pages(1) then on pages(1) it becomes label2 automatically. Apparently, the
code carryover only applies to certain type controls. I will have to
investigate that. Anyhow, I hope this helps you with your project.
 
J

JLGWhiz

Another quirk in copying from page 1 to page 2 of the multiform was that on
the label that I copied, it did not change the caption on the label1 to
label2, but it did change the name to label2, so be careful about those type
disparities.
 
W

WLMPilot

That helps. I will need to test a couple of things. Maybe you can point me
in the direction I should take. Basically this userform, which I use
Multipage Tabbing in, has about 30 fields (textboxes and 3 comboboxes). It
is for a pilot to enter a flight plan into a spreadsheet then print that
flight plan out.

My questions dealt with how to create a way to allow the pilot to edit this
info via the same userform. A commandbutton on sheet(1) (Edit Flight Plan)
would be clicked to execute this. I am not sure if it would be eaiser to
create a page2 (mirror image of page1), or use page1, thus having to capture
which commandbutton was pressed and use it to navigate around the original
code used for page1 (originally entering the data).

Thanks again for your time and input.
Les
 
J

JLGWhiz

I am not sure if I grasped the plan completely, but it seem that you have a
certain number of specific data elements that pertain to the flight plan.
You can do the edit with a multipage or you could create a listbox with the
dataelements listed in it and have the pilot click the data element he wants
to edit. Then the underlying code in the listbox (or combobox if you prefer
dropdowns) could call up the entry for editing.

Example of underlying code to a list/combo box.

Private Sub ListBox1_Click()
If ListBox1.Value = FltPlnItem2 Then
TextBox = FltPlnItem2.Text
End if
End Sub

Done properly, this would only need the one list or combo box and one
textbox to edit all of the flight plan data elements. You would probably
have to have a control button that restarts the macro again after each item
is edited. It would also need to save any changes that were made in the text
box. Just a thought. Might be better than thirty more controls in the
multipage.
 
W

WLMPilot

Wow, if I could get by with that, it would be great. I just cannot grasp how
to do it exactly. I will show you basically what I have. I wish I could say
I have textbox1-22, and for the most part I do. However, I replaced about 5
textboxes with labels since they were pulling in "fixed" data from
spreadsheet vs having to be entered.
Also 3 comboxes (1-3).

My original idea was to use labels to display the different editable items
with an optionbutton beside each. Hence, edit which ever optionbutton is
TRUE.

Hope this gives you an idea.

Les
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top