rdy123 rdy
asked on
location range
hi,
in one macro i gave the file location as,
fileLocation = Application.WorksheetFunct ion.VLooku p(selected Value, Sheets("Template").Range(" A1:B30"), 2, False)
so it pulls from the excel sheet template second column.(where the file location pulls from that range "C:\Templates\xxx.docx")
in other macro i gave as
pathh = "C:\Templates\xxx.docx"
is there any option of giving pathh ="fileLocation" so that it could pick from the filelocation directly instead of giving pathh = "C:\Templates\xxx.docx"
i tried giving this but it is not working,any suggestions please.
code looks like
Sub from()
Dim pathh As String
Dim pathhi As String
Dim oCell As Integer
Dim WA As Object
pathh = "fileLocation"
Set WA = CreateObject("Word.Applica tion")
WA.Documents.Open (pathh)
WA.Visible = True
in one macro i gave the file location as,
fileLocation = Application.WorksheetFunct
so it pulls from the excel sheet template second column.(where the file location pulls from that range "C:\Templates\xxx.docx")
in other macro i gave as
pathh = "C:\Templates\xxx.docx"
is there any option of giving pathh ="fileLocation" so that it could pick from the filelocation directly instead of giving pathh = "C:\Templates\xxx.docx"
i tried giving this but it is not working,any suggestions please.
code looks like
Sub from()
Dim pathh As String
Dim pathhi As String
Dim oCell As Integer
Dim WA As Object
pathh = "fileLocation"
Set WA = CreateObject("Word.Applica
WA.Documents.Open (pathh)
WA.Visible = True
ASKER
thank you,but i am getting runtime error 1004
In which module did you put the code?
Try putting it in a regular module.
Try putting it in a regular module.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window