Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 08-24-2020, 04:11 PM
Guessed's Avatar
Guessed Guessed is offline userForm input for filename Windows 10 userForm input for filename Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

When you say you want those in the Save Box, do you want the static text of "PTLN, PTFN' or do you want the values entered into the userform text boxes?

If you want to pre-populate the default filename when you press F12, you should write that value to the document's Title property. eg
ActiveDocument.BuiltInDocumentProperties(wdPropert yTitle) = "This is a default filename"

In terms of errors on the second code, check your bookmarks actually exist. When your CommandButton1 code runs, it finds the bookmarks and writes text there but there is an insidious bug that removes the bookmark as part of that writing. So you need to reinstate the bookmark after setting the text value if you are going to need the bookmark in the document afterwards.
Code:
Dim PTFN As Range
Set PTFN = ActiveDocument.Bookmarks("PTFN").Range
PTFN.Text = Me.TextBox1.Value
ActiveDocument.Bookmarks.Add Name:="PTFN", Range:=PTFN
Refer to this link for some additional bookmark info Working with Bookmarks in VBA.

I note also that your SaveForm code is not a replacement for the action of pressing F12 unless you have set that as a shortcut key.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
filename field not displaying correct filename when that name starts with # plrsmith Word 1 07-06-2018 03:10 AM
userForm input for filename Filename UnlimitedPower Word VBA 1 08-19-2016 12:22 AM
Userform calls other userform, then populate worksheet Lehoi Excel Programming 0 02-03-2016 02:58 PM
VBA Code in a UserForm module to delete a Command Button which opens the userform Simoninparis Word VBA 2 09-21-2014 03:50 AM
userForm input for filename Is it possible to take an input from a UserForm in one document to a UserForm in a do BoringDavid Word VBA 5 05-09-2014 09:08 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:00 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft