Funky Macro?

  • Thread starter Elizabeth A. Bañuelos
  • Start date
E

Elizabeth A. Bañuelos

I am trying to create a macro that will insert a .jpg saved on the server
into a Word document. I am recording the macro, naming it Signature, and
storing it in Normal. I am using the menu bar for my selections (not using
toolbar buttons). I am selecting menu bar item "DM" (firm created menu bar
item), then Insert, Picture, and Cancel (as jpg's are not stored in DM but
rather on the server), then selecting OK when prompted whether I want Word to
open a document. Then I find the jpg on the server drive, select it, and
click on OK. When I do this outside of recording a Macro, it works
absolutely fine. The result of these steps taken while recording a macro,
simply reads (when viewing the macro in VBA) as follows:

Sub Signature()
'
' Signature Macro
' Macro recorded 4/2/2008 by ebanuelos
'
End Sub

I have even attempted it without using a mouse whatsoever, using the
keyboard for selecting menu bar items and the tab key for selecting "cancel"
when required, etc. and I still get the same result.

Anyone have any suggestions for me? I've never had blank macros happen
before and I'm stuck.

Thanks in advance!
 
G

Graham Mayor

The best way of ensuring that the graphic stays with the template is to save
the graphic as an autotext entry and insert that from a menu button, for
which you don't need vba, however

Sub Signature()
Selection.InlineShapes.AddPicture FileName:= _
"DriveLetter:\Path\Filename.jpg", LinkToFile:=False, _
SaveWithDocument:=True
End Sub

if you replace the drive letter, path and filename with appropriate
locations the above should work.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
E

Elizabeth A. Bañuelos

Thank you Graham. Within minutes of posting (which had been after hours of
trying), I figured out the problem was an issue with the menu bar item DM. I
modified the Menu Bar to add a "from file" selection, and created the macro,
which did then create properly. In the end, it did look suspiciously like
your suggestion here. Thanks again for your help :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top