Results 1 to 9 of 9

Thread: [RESOLVED] Removing File Name From SaveAs Dialog

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Resolved [RESOLVED] Removing File Name From SaveAs Dialog

    NeedSomeAnswers posted some code in my last question that allows me to intercept the Save feature of a Word document, and thus, force the user to use SaveAs instead. This is a good thing as I'm using a couple of templates that I made in Word, and do not want the original template overlaid.

    However, when they click SaveAs, and the SaveAs dialogbox comes up, the original document name is displayed. How can I wipe that out, and present a SaveAs dialog with nothing in the file name textbox?

  2. #2
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    Re: Removing File Name From SaveAs Dialog

    Hack

    Put this in ThisDocument

    VB Code:
    1. Sub FileSaveAs()
    2.   Dim strFileAs As String
    3.   With Application.FileDialog(msoFileDialogSaveAs)
    4.     .InitialFileName = ""
    5.     .Show
    6.     strFileAs = .SelectedItems.Item(1)
    7.   End With
    8.   ActiveDocument.SaveAs strFileAs
    9. End Sub
    Danny

    Never Think Impossible

    If you find my answer helpful then please add to my reputation

  3. #3
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    Re: Removing File Name From SaveAs Dialog

    Any joy??
    Danny

    Never Think Impossible

    If you find my answer helpful then please add to my reputation

  4. #4

    Thread Starter
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [RESOLVED] Removing File Name From SaveAs Dialog

    Works like a champ. Thank you Danny.

    This makes two routines I've copied and pasted into my word document, and I added an error trap all by myself. (Damn I'm good )

    RobDog888: You better watch out buddy, there is a new VBA guru in town!

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] Removing File Name From SaveAs Dialog

    Yes, DMK is quite good but I still rule Office VBA I'm a Leo, remember? King of the Office VBA jungle.

    Soon as I get back from building my block wall there will be a new RobDog888 to watch out for.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6

    Thread Starter
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [RESOLVED] Removing File Name From SaveAs Dialog

    Actually, in a tongue-in-cheek fashion, I was referring to me as the new VBA guru 'cause I copied and pasted two routines I didn't write into a document.

  7. #7
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    Re: [RESOLVED] Removing File Name From SaveAs Dialog

    We shall see.. we shall see...

    Ain't started yet..

    Is that a wall for protection?

    5 gems.. at my rate I'll be six in two more months.. If only they weren't gray..
    Danny

    Never Think Impossible

    If you find my answer helpful then please add to my reputation

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] Removing File Name From SaveAs Dialog

    He he, either way its great to see the VBA forum packing some decent traffic after all my longs moinths of building it up from < 30 threads a month to 200+ threads a month. Thanks to all who help post in VBA.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    Re: [RESOLVED] Removing File Name From SaveAs Dialog

    Yep..

    People under estimate VBA.. some of the stuff I can do with it (Until MSDN Sub my company wouldn't let use anything other than office) will blow your mind..

    I'll be around to help as many as I can for some time
    Danny

    Never Think Impossible

    If you find my answer helpful then please add to my reputation

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