Sir,
Below is my code I want to open file who's path with file name is mention in my sheet "PATH" in "COLUMN c6 ".
I can open file by giving hard cording of file name such as "C:\export\export.docx" but I do not want filenam or filepath to be fixed. so whatever path with file name is given in cell C6 it should open that file only
can anyone help me
Below is my code I want to open file who's path with file name is mention in my sheet "PATH" in "COLUMN c6 ".
I can open file by giving hard cording of file name such as "C:\export\export.docx" but I do not want filenam or filepath to be fixed. so whatever path with file name is given in cell C6 it should open that file only
can anyone help me
VBA Code:
Sub WordToExcel()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Worksheets("pdfexcel").Activate
Range("A11:z10000").Clear
Dim Wdapp As Object, wddoc As Object
Dim LastRow As Long
Dim ExportFile As String
With Sheet1
If ThisWorkbook.Sheets("path").Range("c9").Value = Empty Then
MsgBox "Please Select your PDF File"
GetSelectedPathAndConvert
End If
ExportFile = .Range("c9").Value
End With
Dim rng As Range
Dim i As Integer
On Error Resume Next
Set Wdapp = GetObject(, "word application")
If Err.Number = 429 Then
Err.Clear
Set Wdapp = CreateObject("word.application")
End If
Wdapp.Visible = True
Wdapp.Activate
Set wddoc = Wdapp.Documents(ExportFile)
If wddoc Is Nothing Then
Set wddoc = Wdapp.Documents.Open(ExportFile)
wddoc.Activate
End If