Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jun 2009
    Location
    Hemet CA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    Here the code I have so far. It will only insert picture in Table (1) I'm not sure how to change to allow me to insert a picture's in a selected table where curser is.
    Code:
    Sub RunUp(control As IRibbonControl)
    Dim sFileName As String
    	Dim ilImage As InlineShape
       
    	 With Dialogs(wdDialogInsertPicture)
    		.Display
    		If .Name <> "" Then
    			sFileName = .Name
    			Set ilImage = ThisDocument.Tables(1).Cell(tRow, tCol).Range.InlineShapes.AddPicture(sFileName, , True)
    
    			With ilImage
    				'set any additional properties such as left, top, etc., here
    			End With
    		Else
    			Exit Sub
    		End If
    	End With
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Instead of ThisDocument.Tables(1), use Selection.Tables(1)

    (You could add a check to test whether the insertion point is in a table)

  3. #3
    3 Star Lounger
    Join Date
    Jun 2009
    Location
    Hemet CA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking

    [quote name='HansV' post='784526' date='14-Jul-2009 08:39']Instead of ThisDocument.Tables(1), use Selection.Tables(1)

    (You could add a check to test whether the insertion point is in a table)[/quote]
    Hi HanV
    Yes it does put picture in a table, but it only allows it to go to same location each time. is there a way that I could select location with using my curser, kinda like the standard setting. The reason I'm using a seperate one and not the original command button, is because I'm designing a custom ribbon with just the needed tool on one bar. and using UI Editor I cant seem to put a standard command there.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Why not use just Selection:

    Set ilImage = Selection.InlineShapes.AddPicture(sFileName, , True)

  5. #5
    3 Star Lounger
    Join Date
    Jun 2009
    Location
    Hemet CA
    Posts
    310
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='784739' date='15-Jul-2009 08:06']Why not use just Selection:

    Set ilImage = Selection.InlineShapes.AddPicture(sFileName, , True)[/quote]
    Thank you HanV
    It works Perfect.......

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •