• File save as name (VBA / Access+Word 2000)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » File save as name (VBA / Access+Word 2000)

    Author
    Topic
    #413555

    Hi everyone
    I have some code that generates a Word document (from Access VBA), and then leaves it on the screen (as ‘Document1’) for the user to edit and then save. (The document is not saved by code.) I want to set a default filesave name (that they could change when they save). I’ve found that Word uses the template’s title (if it has one) as the default save as name. Changing the new document’s title doesn’t change it’s default save as name.
    Any ideas how I can set the default file saveas name?
    Thanks
    Peter

    Dim wd As Object
    Dim doc As Word.Document
    
    Set wd = CreateObject("Word.Application")
    Set doc = wd.Documents.Add(Template:="blahblahthing.dot")
    
    With doc
    	'This sets the document's title, but Word uses the original title for the
    	'default filesave name.
    	.BuiltInDocumentProperties(wdPropertyTitle) = "WeeklyReport" & _
    		"For" & UCase(sOfficer) & _
    		Format(dSTart, "d-mmm-yy") & "To" & Format(dEnd, "d-mmm-yy")
    ...
    wd.Visible = True
    doc.Activate
    
    Viewing 1 reply thread
    Author
    Replies
    Viewing 1 reply thread
    Reply To: File save as name (VBA / Access+Word 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: