View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Brian Brian is offline
external usenet poster
 
Posts: 683
Default Referencing User Form from WorkBook

I don't understand. All I have is a hidden sheet in a Work Book (Name of Work
Book varies).

The code I use to open the Work Book is shown below. All I trying to do is
get the information to go from the WorkBook, back to the User Form.

Example:
My User Form is designed to work in conjunction with 3 other Work Books for
each Job.

1: Eng Spec
2: Installer Forms
3: Folder Label

Since there will be alot of Different Work Books, it would be alot easier to
save
the Information from the User Form to A Hidden Sheet in the Work Book (Eng
Spec).

By doing it that way, when ever that Work Book (Eng Spec) is opened the
Information Flows the oppisite direction. As of now the User Form is filled
Out and all 3 Work Books are Updated off of it. Then all the Work Books are
saved in there own Job Directory. I want to save the information for each
Job, with that job.

Now I go to open an exsisitng workBook how do i get the information back to
the User Form without retyping it?




"Brian" wrote:

I have a User Form that once it is filled in, it updates several other Work
Books from different Control Buttons.

I need to save the Input on the User Form in one of the Wook Books, so that
if the Work Book is opened again the User Form automatically Fills back in.
I have the following code for when my Work Book is opened:

' Open Existing Eng Spec 9 Control Button
Private Sub Open_Existing_Eng_Spec_9_Click()

Dim FileToOpen As Variant
Dim bk As Workbook
Dim LastBackSlashPos As Long
Dim myMsg As String

FileToOpen = Application.GetOpenFilename("SPEC (*.xlsm), Spec*.xlsm")

If FileToOpen = False Then

MsgBox prompt:=Engineering_2.Value & vbLf & "You canceled opening an
Engineering Spec", _
Title:="C.E.S."

' MsgBox "User Canceled Operation, No Engineering Spec was Opened",
, "C.E.S."
Exit Sub
End If

LastBackSlashPos = InStrRev(FileToOpen, "\", -1, vbTextCompare)

If UCase(Mid(FileToOpen, LastBackSlashPos + 1, 4)) < UCase("SPEC") Then

MsgBox prompt:=Engineer_2.Value & vbLf & "You can only open an
exsisting Engineering Spec", _
Title:="C.E.S."

Exit Sub
End If

Set bk = Workbooks.Open(Filename:=FileToOpen)
'================================================= ====
'Update Data Storage Sheet (Hidden in Job Work Book)
'================================================= ====

With Workbooks("Master Engineering Spec.xlsm").Sheets("COVER SHEET")
' Site Information:
Me("CLLI_Code_1").Value = .Range("D02").Value
Me("Office_1").Value = .Range("D03").Value
Me("Address_11").Value = .Range("D04").Value
Me("Address_12").Value = .Range("D05").Value

More Code like above here

' Line 46
Me("Type_Work_723").Value = .Range("C83").Value
Me("Bay_Description_723").Value = .Range("J83").Value
Me("Bay_ID_723").Value = .Range("F83").Value
Me("Description_Work_723").Value = .Range("M83").Value
'================================================= ====

End Sub


How would I reference the User Form from the Work Book so that when the Work
Book is opened the Data from the hidden Sheet is automaticaly sent back to
the User Form to fill it back in?

User Form = UserForm1
Work Book = Master Engineering Spec.xlsm
Sheet = Job Data