Posts by jaycee

    Using Word VBA I need to see if a file is present somewhere on a hard drive. For example I need to start at the root (C:\) and go through all the folders looking for 'File.exe' and when found display the full path. I'm sure this is possible but just can't find a way to do it. Many Thanks

    Re: Restoring default template

    Ok another thought...
    Open an old document (which you say is ok), go to File/Page Setup check all the settings (margins, paper size etc.) then click the Default button. A dialogue box will ask you if you want to change the default settings and that it will affect all new documents, click the Yes button.
    Hope this is of some help

    Re: Restoring default template

    This may be stupid but have you checked your 'View' setting (on the menu bar). If it's set to 'Normal', 'Web Layout' or 'Outline' it will appear as you describe - if it is change it to 'Print Layout' and everything will be ok. This is for Word 2000 and may be different for other versions.

    Re: Text deletion

    Hi Han,
    Try this:
    1. Select 'Tools' from the main menu
    2. Select 'Options' from the drop down menu
    3. Select the 'Edit' tab
    4. Tick the 'Typing replaces selection' box

    If this box is not ticked you get exactly the effect you are describing

    Re: Search non-ascii in text file and highlight

    Not quite sure what you're after but the following checks if each character is less than asc 48 and highlights it if so.

    By using AND with the Asc(Selection) you could easily get it to check for different ranges of ascii characters

    Re: Allowing to type anything in TextBox except for:

    Hi Nawaf,
    Hope you enjoyed your leave.

    I'll do what I can to help but before I start can you give me more of an idea of what you are trying to achieve. If possible upload a copy of how you want your document to look and let me know roughly what information you need your users to input and where you want the data inserting etc.

    Re: Select/copy all text on a page

    Don't know if this is any help. It will let you select which page you want to copy.

    Dim NumberPages As Integer
    Dim PageNo As Integer
    NumberPages = Selection.Information(wdNumberOfPagesInDocument)
    PageNo = InputBox("Enter page number to copy")
        Selection.GoTo What:=wdGoToPage, Which:=wdGoToFirst, Count:=PageNo
        With Selection
        End With

    Re: Word List box from external network file

    Sorry but I missed a couple of lines (see below). The FreeFile() returns an integer for the next file number available for use by the Open statement

    Re: Word List box from external network file

    I perhaps should have mentioned that File.txt is a simple text file (use Notepad) with each item you want to import on a new line e.g.

    This would read each day of the week in to the list and make Monday appear in the box

    Re: Word List box from external network file

    Hi bamsch,
    The following is something I've used on a number of occassions. I've made it generic so you just need to change the location/file name etc.

    Re: Allowing to type anything in TextBox except for:

    I'm assuming that you want to save the document via the normal File | Save menu system rather than having a button on the document page? If so then I think the only way to check the textbox is to do it every time a character is entered, which would mean that you couldn't check for NA or include spaces in the text. Rather than include a text box in the document have you considered using VBA's UserForms to allow your user to enter data which you can then validate. If you're not familiar with using VBA in this way let me know and I'll put something together for you.


    Re: Ms Outlook Preview Pane Won't Work

    I heard that too so always keep the preview off and only open emails from sources I know. Checked all the settings I could though but not able to help as my preview option is available

    Re: Allowing to type anything in TextBox except for:

    Ok, I see the problem now. You've inserted the code into the Textbox1_Change() procedure. What will happen is that everytime you enter or change text in the box the file will be saved.

    To prevent this, create a command button either below or to the side of your text box and put the code in the cmdSave_Click() procedure and remove the Textbox1_Change() procedure. Now the save operation will only happen when your user has entered data correctly and clicked on the Save button.

    I've updated your file and attached it so you can hopefully see what I mean

    Re: Allowing to type anything in TextBox except for:

    This will check for various entries. Include a command button to save the document. When a user clicks on the save button the various checks will be made and if everything is ok it will save the document otherwise it will prompt the user accordingly. Hope this is of some help.

    Re: Allowing to type anything in TextBox except for:

    Don't know if this helps:

    Re: Word template

    Hi Zeff,
    What you're asking is quite possible but I need more information before I can help. Post what info you can and I'll try and come up with something.