none
Dialogs(wdDialogInsertPicture) - The remote server machine does not exist or is unavailable (Error 462) RRS feed

  • Question

  • Private Sub Foto_DblClick(Cancel As Integer)

    Me!Foto.Enabled = True   

    Me!Foto.Locked = False   

    Me!Foto.OLETypeAllowed = acOLEEmbedded   

    Me!Foto.Class = "Word.Document"   

    Me!Foto.Action = acOLECreateEmbed   

    Me!Foto.Action = acOLEActivate   

    Me!Foto.SizeMode = acOLESizeZoom  

        

    Dim strFile As String    

       

    Dim oDialog As Word.Dialog   

    Set oDialog = Dialogs(wdDialogInsertPicture) 'the second call to an error -The remote server machine does

    'not exist or is unavailable (Error 462)   

    With oDialog       

    .Display       

    If .Name <> "" Then          

    strFile = .Name       

    End If   

    End With   

    Set oDialog = Nothing   

    Me.Foto.Object.Shapes.AddPicture (strFile)

    End Sub




    • Edited by Andatrios Tuesday, March 26, 2013 7:31 PM Edit
    Tuesday, March 26, 2013 7:27 PM

Answers

  • Use the following to get the path\filename of the picture:

    Dim fd As FileDialog
    Dim strFile As String
    Set fd = Application.FileDialog(msoFileDialogFilePicker)
    With fd
        .Title = "Select the picture that you want to insert."
        .Filters.Clear
        .Filters.Add "Pictures", "*.jpg;*.bmp;*.gif;*.png" 'include additional file types as required, separating each with a semi-colon
        .AllowMultiSelect = False
        If .Show = -1 Then
            strFile = .SelectedItems(1)
        Else
            MsgBox "You did not select a picture."
            Exit Sub
        End If
    End With


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org

    Wednesday, March 27, 2013 3:15 AM
  •     After dancing with tambourines come to the right decision.

        Me!Foto.Enabled = True
        Me!Foto.Locked = False
        Me!Foto.OLETypeAllowed = acOLEEmbedded
        Me!Foto.Class = "Word.Document"
    '    'Me!Foto.SourceDoc = "C:\1.jpg"
        Me!Foto.Action = acOLECreateEmbed
        Me!Foto.Action = acOLEActivate
        Me!Foto.SizeMode = acOLESizeZoom

        Dim strFile As String

        Dim oDialog As Word.Dialog
        Set oDialog = Me!Foto.Object.Parent.Dialogs(wdDialogInsertPicture)

        With oDialog
            .Display
            If .Name <> "" Then
               strFile = .Name
            End If
        End With
        Set oDialog = Nothing
        Me.Foto.Object.Shapes.AddPicture (strFile)

    End Sub

            Doug Robbins thank you! It is a good alternative.
    • Marked as answer by Andatrios Friday, March 29, 2013 8:20 AM
    Friday, March 29, 2013 8:19 AM

All replies

  • Use the following to get the path\filename of the picture:

    Dim fd As FileDialog
    Dim strFile As String
    Set fd = Application.FileDialog(msoFileDialogFilePicker)
    With fd
        .Title = "Select the picture that you want to insert."
        .Filters.Clear
        .Filters.Add "Pictures", "*.jpg;*.bmp;*.gif;*.png" 'include additional file types as required, separating each with a semi-colon
        .AllowMultiSelect = False
        If .Show = -1 Then
            strFile = .SelectedItems(1)
        Else
            MsgBox "You did not select a picture."
            Exit Sub
        End If
    End With


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org

    Wednesday, March 27, 2013 3:15 AM
  •     After dancing with tambourines come to the right decision.

        Me!Foto.Enabled = True
        Me!Foto.Locked = False
        Me!Foto.OLETypeAllowed = acOLEEmbedded
        Me!Foto.Class = "Word.Document"
    '    'Me!Foto.SourceDoc = "C:\1.jpg"
        Me!Foto.Action = acOLECreateEmbed
        Me!Foto.Action = acOLEActivate
        Me!Foto.SizeMode = acOLESizeZoom

        Dim strFile As String

        Dim oDialog As Word.Dialog
        Set oDialog = Me!Foto.Object.Parent.Dialogs(wdDialogInsertPicture)

        With oDialog
            .Display
            If .Name <> "" Then
               strFile = .Name
            End If
        End With
        Set oDialog = Nothing
        Me.Foto.Object.Shapes.AddPicture (strFile)

    End Sub

            Doug Robbins thank you! It is a good alternative.
    • Marked as answer by Andatrios Friday, March 29, 2013 8:20 AM
    Friday, March 29, 2013 8:19 AM