HZGN.COM
welcome to my space
X
Search:  
Welcome to:hzgn.com
NAVIGATION: Home >>
Serious word problem
Published by: cfz 2009-01-07

  • ive got a document that creates a new word doc and saves it as a name given by the user from an input box.

    the macro then checks some checkboxes and attempts to copy the contents of many different word templates if the checkbox is checked.

    however i cant get the copy and paste to work. heres the code and any help is greatly apreciated :crap:

    code/

    Private Sub CommandButton1_Click()
    '
    '
    Dim cusnom As String
    Dim prname As String
    Dim fname As String
    Dim details(1)
    Dim final As String
    '
    cusnom = InputBox("Please enter the customer's company name.")
    '
    TextBox1 = cusnom
    '
    If CheckBox1 = True Then
    prname = InputBox("Please Confirm Project Name/Number, (this MUST match the name given on the project folder)")
    '
    fname = prname & "Erection File" & ".doc"
    details(0) = fname
    details(1) = prname
    '
    'in theory this should copy all the templates from their seperate folders to the one single folder named prname or fname
    '
    'selecting textbox and writing details
    '
    TextBox2.Select
    TextBox2 = prname
    '
    ChangeFileOpenDirectory _
    "C:Documents and SettingsmynameDesktopErectionfile"
    Documents.Open FileName:="erectorsinstructions.dot", ConfirmConversions:= _
    False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
    PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
    WritePasswordTemplate:="", Format:=wdOpenFormatAuto
    Selection.WholeStory
    Selection.Copy

    Selection.Paste
    'pastes selection

    ActiveDocument.SaveAs FileName:=fname

    'saves document as fname


    '
    End If
    '
    End Sub

    code

    basically how do i make the file saved as "fname" the activedocument so i can reference it in many copy paste functions.


  • ok but i still have a similar problem: the second if function does not recognise the file or window "final"

    code/


    Private Sub CommandButton1_Click()
    '
    '
    Dim cusnom As String
    Dim prname As String
    Dim fname As String
    Dim details(1)
    Dim final As String
    '
    cusnom = InputBox("Please enter the customer's company name.")
    '
    TextBox1 = cusnom
    '
    If CheckBox1 = True Then
    prname = InputBox("Please Confirm Project Name/Number, (this MUST match the name given on the project folder)")
    '
    final = prname & "Erection File"
    fname = prname & "Erection File" & ".doc"

    TextBox2.Select
    TextBox2 = prname
    '
    Documents.Add DocumentType:=wdNewBlankDocument
    ChangeFileOpenDirectory _
    "C:Documents and SettingsDavid.BuckokeDesktoperectionfile"
    Selection.InsertFile FileName:="KeyContacts.dot", Range:="", _
    ConfirmConversions:=False, Link:=False, Attachment:=False
    '
    ActiveDocument.SaveAs FileName:=fname

    End If

    If CheckBox2 = True Then

    TextBox2.Select
    TextBox2 = prname
    '
    final = prname & "Erection File"
    Windows(final).Activate

    ChangeFileOpenDirectory _
    "C:Documents and SettingsDavid.BuckokeDesktoperectionfile"
    Selection.InsertFile FileName:="KeyContacts.dot", Range:="", _
    ConfirmConversions:=False, Link:=False, Attachment:=False

    End If

    End Sub


  • Don't use copy/paste. Use Insert-File. I think you'll be alot happy. Also, investigage IncludeText as an option. This way, you're not even touching those files from which you want to "copy".





  • Red Hat's Rough Recovery From CFO Exit
    Windows Live Finds a New, Pre-installed Home

    You are looking at:hzgn.com's Serious word problem, click hzgn.com to home
  • whats going on or is this normal
  • what drives radical feminism
  • do people think only whites can be racist
  • how many shots of vodka will it take to get drunk tipsy
  • what is the reason for this
  • everyone attending the facebook blackout
  • i am 14 and i run the hundred meter sprints in 12 23s do i have a future as a professional sprinter
  • what are the effects on the spanish occupation in the phillippines
  • for the girl laparoscopy
  • how long has it been since men and women weren 039 t equal
  • have you ever got your period on camp
  • not having a gap on the pill
  • girls with pcos what are the treatments
  • how do i get good at running long distances
  • did you eat my tuna salad
  • what is facebook all about thinking about getting one
  • help ideas time is running out
  • is itching associated with a thyroid problem
  • is my discharge normal
  • which are your thoughts on this approach about double bind
  • how many miles per hour a human can reach at top speed
  • how long can you run at 6mph without stoping
  • dank weed gets me super high and i hate it and i like to smoke alot if i smoke mids will it get me less high
  • who is your fav music artist
  • how can my body get used to alcohol
  • do you think this sounds ok or stupid for my boyfriend
  • his penis just wouldnt go in during my first time not sure how to go about fixing this
  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Serious word problem , Please add it free.

    About us -Site map -Advertisement -Jion us -Contact usExchange linksSponsor us
    Copyright© 2008 hzgn.com All Rights Reserved
    Site made&Support support@hzgn.com    E-mail: web@hzgn.com