gayjaybird
New Member
- Joined
- Aug 6, 2007
- Messages
- 39
I'm using Microsoft Word 2007. I am trying to write a macro to format selected text and place an icon to the left of it in documentation. Here's the code I've managed to come up with:
There are 3 different sets of formatting that they want, but the logic works the same in each. I generated this code by recording the macro and performing the functions I needed. How do I code the file path of the icon so that I can share this with other users? A network path is not desirable because there may be multiple users accessing the image at the same time. The only way I could see is to create a folder on each user's PC and then edit the coding so it reflects the proper file path. Is there a way to dynamically do this so I don't have to keep re-editing the macro?
Code:
Sub OnePointTip()
'
' OnePointTip Macro
'
'
Selection.Font.Name = "Times New Roman"
Selection.Font.Size = 12
Selection.Cut
Selection.InlineShapes.AddPicture FileName:= _
"C:\Users\gayjaybird\Desktop\projectTemplates\tip.gif", LinkToFile:=False, _
SaveWithDocument:=True
Selection.Cells.Split NumRows:=1, NumColumns:=2, MergeBeforeSplit:=False
Selection.Cells(1).Next.Select
Selection.PasteAndFormat (wdPasteDefault)
End Sub
There are 3 different sets of formatting that they want, but the logic works the same in each. I generated this code by recording the macro and performing the functions I needed. How do I code the file path of the icon so that I can share this with other users? A network path is not desirable because there may be multiple users accessing the image at the same time. The only way I could see is to create a folder on each user's PC and then edit the coding so it reflects the proper file path. Is there a way to dynamically do this so I don't have to keep re-editing the macro?