CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2013
    Posts
    3

    change of seperator when using SaveAs, instead of 07/08/13 it needs to be 07.08.13

    Good morning all,
    I have a small programme running which requires the form to be saved after completion. It needs to be saved just by date and time, so using the following code
    Code:
    Application.Dialogs(xlDialogSaveAs). Show Now()
    The only problem is that when the date and time are saved they have seperators which will not save ie. 07/08/13 09:01:30. I need to be able to change this to
    07.08.13 09.01.30. Could somebody please show me how to do this.

    Many thanks
    Robbosan

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: change of seperator when using SaveAs, instead of 07/08/13 it needs to be 07.08.1

    This might work for you :

    http://www.vb6.us/tutorials/formatin...-and-times-vb6

    Although it is not separated with dots, but I think you'll get the idea

  3. #3
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: change of seperator when using SaveAs, instead of 07/08/13 it needs to be 07.08.1

    You may be able to use Replace() as well
    Code:
    Dim AlteredDate as String
    AlteredDate=Replace(Now(), "/", ".")
    Msgbox AlteredDate
    The same can work for any character it this case you would need to use it more than once
    Last edited by DataMiser; August 8th, 2013 at 04:42 PM.
    Always use [code][/code] tags when posting code.

  4. #4
    Join Date
    Aug 2013
    Posts
    3

    Re: change of seperator when using SaveAs, instead of 07/08/13 it needs to be 07.08.1

    Sorry for the delay in reply had to go away for afew days with work.
    Many thanks for that it is a good reference point to begin with.

    Best regards
    Robbosan

  5. #5
    Join Date
    Aug 2013
    Posts
    3

    Re: change of seperator when using SaveAs, instead of 07/08/13 it needs to be 07.08.1

    Sorry for the delay in reply had to go away for a few days with work.
    Many thanks for that it cetainly worked for my problem.

    Best regards
    Robbosan

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured