PDA

View Full Version : Word 2003 Macro Help - Control V



KaitlynK
06-14-2016, 08:00 AM
I am trying to copy text to become the name of my file. When I make the macro and use Control V and then save the macro, every single time I use the macro, it retains the original file name, i.e. it is not recording the actual "Control V" command, but rather recording what was copied before and inserting the original text that was used to make the macro. Is there a way I can make it use the current text used each time?

gmaxey
06-14-2016, 08:59 AM
What is you macro?

KaitlynK
06-14-2016, 09:36 AM
Sub Macro13()
'
' Macro13 Macro
' Macro recorded 6/14/2016 by k
'
End Sub
Sub Macro14()
'
' Macro14 Macro
' Macro recorded 6/14/2016 by k
'
End Sub
Sub Macro15()
'
' Macro15 Macro
' Macro recorded 6/14/2016 by k
'
ChangeFileOpenDirectory "C:\Users\ma\Documents\Aui\Send Pr\"
ActiveDocument.SaveAs FileName:="121134.doc", FileFormat:=wdFormatDocument _
, LockComments:=False, Password:="", AddToRecentFiles:=True, _
WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
End Sub


I am new to this, but essentially these are the keystrokes I used:

Alt F (To Open File)
Alt A (To Save)
Alt 2 (To Go Up Two Folders)
Type in the Name of The Folder I Want (Send)
Return to Choose
Control V to Enter the Required Name

Essentially, I am given a name in another program for the file name, I have to copy that name, go to a format file in a folder, choose the format, and then resave to a new folder. I use that format to edit and type my document. I am using Word 2003.

Thank you.

gmaxey
06-14-2016, 10:04 AM
I'm sorry, it has been a long time sine I used Word 2003 regularly and I have never been a keyboard shortcut person. When I press Alt F in Word 2003, nothing happens.

You might try changing FileName:="121134.doc" To FileName:=GetFromCB and including the following function.


Function GetFromCB() As String
Dim myPaste As DataObject
Set myPaste = New DataObject
'Must have a reference to Microsoft Forms 2.0 Object Library enabled
myPaste.GetFromClipboard
GetFromCB = myPaste.GetText(1)
End Function