+ Reply to Thread
Results 1 to 6 of 6

continous error message

  1. #1
    Registered User
    Join Date
    04-04-2013
    Location
    Northampton
    MS-Off Ver
    Excel 2010
    Posts
    40

    Talking continous error message

    Good morning,
    I have written the script for this autosave using one button and I keep getting an error message which highlights the
    ActiveWorkbook.SaveAs Filename:= _ fileSaveName, FileFormat:=xlNormal, _ CreateBackup:=False

    and I cannot see where the problem lies. Would anyone be able to help please. The full script is underneath:-

    Sub Picture7_Click()

    Application.DisplayAlerts = False

    template_file = ActiveWorkbook.FullName
    fileSaveName = Application.GetSaveAsFilename( _
    InitialFileName:="C:\Users\robert.french\Excel spreadsheets\Event job booking\Inventory\filename_" + VBA.Strings.Format(Now) + ".xls", _
    fileFilter:="Xls Files (*.xls), *.xls")
    If fileSaveName = False Then
    Exit Sub
    End If
    ActiveWorkbook.SaveAs Filename:= _
    fileSaveName, FileFormat:=xlNormal, _
    CreateBackup:=False

    file_name_saved = ActiveWorkbook.Filename
    MsgBox "Your Event No.upload file has been successfully created at: " & vbCr & vbCr & file_name_saved


    ActiveWorkbook.SaveAs Filename:= _
    template_file, FileFormat:= _
    xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
    , CreateBackup:=False

    Application.DisplayAlerts = True


    End Sub

    Many Thanks
    Robbosan

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: continous error message

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    04-04-2013
    Location
    Northampton
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: continous error message

    Sorry I do not understand?

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: continous error message

    like this
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-04-2013
    Location
    Northampton
    MS-Off Ver
    Excel 2010
    Posts
    40

    Re: continous error message

    Hi Martin,
    I am sorry I am new to programming and to write that took me a couple of days of trial and error. I just copied over from the VB page to the thread box, is below what you mean? Otherwise I am sorry I do not understand how it is to be written.

    Sub Picture7_Click()
    Application.DisplayAlerts = False
    template_file = ActiveWorkbook.FullName
    fileSaveName = Application.GetSaveAsFilename( _InitialFileName:="C:\Users\robert.french\Excel spreadsheets\Event job booking\Inventory\filename_" + VBA.Strings.Format(Now) + ".xls", _fileFilter:="Xls Files (*.xls), *.xls")
    If fileSaveName = False Then
    Exit Sub
    End If
    ActiveWorkbook.SaveAs Filename:= _fileSaveName, FileFormat:=xlNormal, _CreateBackup:=False
    file_name_saved = ActiveWorkbook.Filename
    MsgBox "Your Event No.upload file has been successfully created at: " & vbCr & vbCr & file_name_saved
    ActiveWorkbook.SaveAs Filename:= _template_file, FileFormat:= _xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _, CreateBackup:=False
    Application.DisplayAlerts = True

    End Sub

    Many thanks

    Robbosan

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: continous error message

    if you read the forum rules-specifically rule 3-it should all become clear ;-)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. vba print continous with paper continous and epson LQ300?
    By heroic in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-07-2013, 03:22 AM
  2. Replies: 2
    Last Post: 05-22-2013, 12:38 PM
  3. An error message on open - a totally blank VBA message box
    By Mr_Tigas in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-05-2013, 11:29 AM
  4. Replacing run time error message with a different message
    By penny in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-14-2009, 10:51 AM
  5. replace VBA run-time error message with custom message
    By BEEJAY in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-14-2006, 11:05 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1