ユーザーが自分のフォルダからPDFファイルを選択できるようにするこのVBAマクロが必要です。マクロはPDFを固定フォルダのコピー先にコピーし、コンボボックスで選択された2つの値。ダイアログボックスでユーザーが選択したファイルをコピーして名前を変更するVBA
次のコードを試しましたが、最後の文で失敗します。私を助けることができる人は誰ですか?
Sub add_testrepport()
Dim intChoice As Integer
Dim strPath As String
'allow the user to select one file
Application.FileDialog(msoFileDialogOpen).AllowMultiSelect = False
'make the file dialog visible to the user
intChoice = Application.FileDialog(msoFileDialogOpen).Show
'determine what choice the user made
If intChoice <> 0 Then
'get the file path selected by the user
strPath = Application.FileDialog(_
msoFileDialogOpen).SelectedItems(1)
'copy the file path to filecopy
FileCopy strPath, "K:\05_RAP\Klement\Test"
End If
End Sub
ながら何を見つけましたか?あなたはそれを実行しようとしましたか?何が起こった? –