0

I got a command button to insert and resize an image (company logo). When printing I want this command button to be hidden, but the logo has of course to be visible. My problem is that if the command button is hidden, then the logo is hidden as well. I couldn't come up with a code that hides the command button while keeping the logo visible. I have also tried using Toggle Field Codes but had the same problem... Any ideas?

Here's the code so far (which works well):

Dim oShp As Shape
    
    'Select and insert the Pic
    With Application.FileDialog(msoFileDialogFilePicker)
        .Title = "Select image files and click OK"
        .Filters.Add "Images", "*.gif; *.jpg; *.jpeg; *.bmp; *.tif; *.png"
        .FilterIndex = 2

        If .Show = -1 Then
            
            Set oShp = ActiveDocument.Shapes.AddPicture( _
            FileName:=.SelectedItems(1), _
            LinkToFile:=False, _
            SaveWithDocument:=True, _
            Left:=5, _
            Top:=12)
            
            With oShp
                .LockAspectRatio = msoCTrue
                .Width = InchesToPoints(2)
            End With
            
        Else
           
    End If       

End With 
macropod
  • 12,757
  • 2
  • 9
  • 21
CNA
  • 3
  • 1
  • Take a look at https://wordmvp.com/FAQs/TblsFldsFms/HidePrintButton.htm. Consider also using a QAT button rather than a Command Button. – Charles Kenyon Oct 01 '22 at 02:56
  • Thank you. Not exactly what I am looking for, since I need to add a print or save button for this workaround, but would be a plan b. Thanks – CNA Oct 01 '22 at 09:00
  • if I add a QAT button, will other users have it on the ribbon as well? – CNA Oct 01 '22 at 10:10
  • Is there any reason you can't use a picture content control? – macropod Oct 01 '22 at 13:11
  • If you add the QAT button to a document, it will be on the other user's computer. You need to pay attention to where you save the modification. If added to a template, though, it will not appear on a document created from the template when the template is not attached. https://addbalance.com/word/QATmodification.htm – Charles Kenyon Oct 01 '22 at 14:03
  • If you add the QAT button to a document, it will be on the other user's computer. You need to pay attention to where you save the modification. If added to a template, though, it will not appear on a document created from the template when the template is not attached. https://addbalance.com/word/QATmodification.htm#PageStart – Charles Kenyon Oct 01 '22 at 14:09
  • Thank you. I made a workaround to my problem. Question can be closed – CNA Oct 02 '22 at 14:57

0 Answers0