Consulting

Results 1 to 5 of 5

Thread: Newbie Help - Userform

  1. #1

    Newbie Help - Userform

    Hi,

    I am tyring to set up a contract document with a userform in word to enter all the input information throughout the document. all fields are setup in the document and the reference names are all correct however I am getting an issue with my code when I run it, which is no surprise really!

    If anyone could give me some assistance, it would be much appreciated!
    Option Explicit
     
    Private Sub UserForm_Initialize()
       With cboWorks_Ins
          .AddItem "Alternative 1"
          .AddItem "Alternative 2"
       End With
       With cboPL_Ins
          .AddItem "Alternative 1"
          .AddItem "Alternative 2"
       End With
       With cboPC_Date_Time
          .AddItem "Date"
          .AddItem "Duration (in weeks)"
       End With
    End Sub
    
    
    Private Sub cmdCancel_Click()
       Unload Me
       ActiveDocument.Close SaveChanges:=False
    End Sub
    
    
    Private Sub cmdOK_Click()
        
        Application.ScreenUpdating = False
        With ActiveDocument
           .Bookmarks("Project_No").Range.Text = txtProject_No.Value
           .Bookmarks("Proj_Name").Range.Text = txtProj_Name.Value
           .Bookmarks("Client").Range.Text = txtClient.Value
           .Bookmarks("Client_Address").Range.Text = txtClient_Address.Value
           .Bookmarks("Client_ABN").Range.Text = txtClient_ABN.Value
           .Bookmarks("Council").Range.Text = txtCouncil.Value
           .Bookmarks("Water_Auth").Range.Text = txtWater_Auth.Value
           .Bookmarks("Elect_Auth").Range.Text = txtElect_Auth.Value
           .Bookmarks("Main_Drain_Auth").Range.Text = txtMain_Drain_Auth.Value
           .Bookmarks("Comms_Auth").Range.Text = txtComms_Auth.Value
           .Bookmarks("Tender_Close").Range.Text = txtTender_CLose.Value
           .Bookmarks("LDs").Range.Text = txtLDs.Value
           .Bookmarks("Works_Ins").Range.Text = cboWorks_Ins.Value
           .Bookmarks("PL_Ins").Range.Text = cboPL_Ins.Value
           .Bookmarks("Possession_Time").Range.Text = txtPossession_Time.Value
           .Bookmarks("Possession_Trigger").Range.Text = txtPossession_Trigger.Value
           .Bookmarks("PC_Date_Time").Range.Text = cboPC_Date_Time.Value
           .Bookmarks("PC").Range.Text = txtPC.Value
        End With
        Application.ScreenUpdating = True
        Unload Me
     End Sub
    Last edited by Paul_Hossler; 10-16-2017 at 05:24 PM. Reason: Added CODE tags

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    I think the *cough cough* error is in the *cough cough* line
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    Welcome to the forum

    I added CODE tags around your macro for formatting and readability -- use the [#] next time

    I am getting an issue with my code when I run it,
    Afraid that doesn't help much

    Can you attach a sanitized (if necessary) document that shows the issue?

    My sig has instructions
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  4. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    Ninja-ed by SamT again
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  5. #5
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    I dint see nuttin in dat code dat jumped up an said "I'm bad!"
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •