2016-07-18 16 views
0

ExcelでWord文書を開き、その中にたくさんの情報をダンプします。私は、文書が実際に開かれたかどう見当がつかないExcelでVBAを使用してMicrosoft Word文書を開きます

  1. どのように私は閉じて保存します:

    'Declare a variable as a FileDialog object and create a FileDialog object as a File Picker dialog box 
        Dim iFileSelect As FileDialog 
        Set iFileSelect = Application.FileDialog(msoFileDialogFilePicker) 
    
        'Declare a variable to contain the path of each selected item 
        Dim vrtSelectedItem As Variant 
    
    
        'Use the Show method to display the File Picker dialog box 
        'The user pressed the action button 
        If iFileSelect.Show = -1 Then 
    
        For Each vrtSelectedItem In iFileSelect.SelectedItems 
        'vrtSelectedItem contains path of each selected item 
        MsgBox "The path is: " & vrtSelectedItem 
        Next vrtSelectedItem 
    
        End If 
    
        'Set object variable to Nothing 
        Set iFileSelect = Nothing 
    

    I "M持つ次の問題:私は、次のコードを使用しています。ファイル私はそれに情報をダンプしたら?

答えて

0

Excelで開いているブックを持っている場合は、あなただけの文書を開くには、そのFollowHyperlinkメソッドを使用することができます。

Sub OpenDoc() 
    Dim iFileSelect As FileDialog 
    Set iFileSelect = Application.FileDialog(msoFileDialogFilePicker) 

    Dim vrtSelectedItem As Variant 

    If iFileSelect.Show = -1 Then 
     For Each vrtSelectedItem In iFileSelect.SelectedItems 
      ActiveWorkbook.FollowHyperlink vrtSelectedItem 
     Next vrtSelectedItem 
    End If 

    Set iFileSelect = Nothing 
End Sub 
+0

クール。しかし、VBAからどのように編集して保存しますか?鍵を送る......ちょうど冗談です:) – cyboashu

関連する問題