Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi al..
I have a problem.. I placed the question here last week aswell, unfortunatly it did not solve my problem.. Scope: I have a userform where I would like to add some buttons wich open certain adobe PDF files. Furthermore, this project is to be burned on a CD so it can be distributed. My problem are the drive letters.. (diffrent systems, diffrent drive letters..) this is the code i'm using.. _______________ Private Sub CommandButton19_Click() 'open pdf file Dim filelocation As String filelocation = ThisWorkbook.Path _________________ I'm missing the last part where I call the variable filelocation and open the pdf file.. Who can help me out? -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Arjan,
Depends where the PDFs are relative to the Excel WB. You already have ThisWorkbook.Path, so if they in a sub folder of that : ThisWorkbook.Path & "\PDF_Folder\PDF1.pdf" If you maybe on Mac then you would need to do bit work at detecting that first. NickHK "Arjan" wrote in message ... Hi al.. I have a problem.. I placed the question here last week aswell, unfortunatly it did not solve my problem.. Scope: I have a userform where I would like to add some buttons wich open certain adobe PDF files. Furthermore, this project is to be burned on a CD so it can be distributed. My problem are the drive letters.. (diffrent systems, diffrent drive letters..) this is the code i'm using.. _______________ Private Sub CommandButton19_Click() 'open pdf file Dim filelocation As String filelocation = ThisWorkbook.Path _________________ I'm missing the last part where I call the variable filelocation and open the pdf file.. Who can help me out? -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nick,
Thanks for your reply.. The files are in the same path as the workbook. However, what I don't know is the how to open the file(s).. what code do I have to use? Arjan -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** "NickHK" wrote: Arjan, Depends where the PDFs are relative to the Excel WB. You already have ThisWorkbook.Path, so if they in a sub folder of that : ThisWorkbook.Path & "\PDF_Folder\PDF1.pdf" If you maybe on Mac then you would need to do bit work at detecting that first. NickHK "Arjan" wrote in message ... Hi al.. I have a problem.. I placed the question here last week aswell, unfortunatly it did not solve my problem.. Scope: I have a userform where I would like to add some buttons wich open certain adobe PDF files. Furthermore, this project is to be burned on a CD so it can be distributed. My problem are the drive letters.. (diffrent systems, diffrent drive letters..) this is the code i'm using.. _______________ Private Sub CommandButton19_Click() 'open pdf file Dim filelocation As String filelocation = ThisWorkbook.Path _________________ I'm missing the last part where I call the variable filelocation and open the pdf file.. Who can help me out? -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you just want to open them in the user's defualt app for pdf files :
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long ShellExecute 0, "open", Thisworkbook.path & "\YourPDF.pdf", "", "", 1 NickHK "Arjan" wrote in message ... Nick, Thanks for your reply.. The files are in the same path as the workbook. However, what I don't know is the how to open the file(s).. what code do I have to use? Arjan -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** "NickHK" wrote: Arjan, Depends where the PDFs are relative to the Excel WB. You already have ThisWorkbook.Path, so if they in a sub folder of that : ThisWorkbook.Path & "\PDF_Folder\PDF1.pdf" If you maybe on Mac then you would need to do bit work at detecting that first. NickHK "Arjan" wrote in message ... Hi al.. I have a problem.. I placed the question here last week aswell, unfortunatly it did not solve my problem.. Scope: I have a userform where I would like to add some buttons wich open certain adobe PDF files. Furthermore, this project is to be burned on a CD so it can be distributed. My problem are the drive letters.. (diffrent systems, diffrent drive letters..) this is the code i'm using.. _______________ Private Sub CommandButton19_Click() 'open pdf file Dim filelocation As String filelocation = ThisWorkbook.Path _________________ I'm missing the last part where I call the variable filelocation and open the pdf file.. Who can help me out? -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Are you using a fileopen dialog box for the user to select the file?
If not, you could try using it...it will return you the entire path of the selected file/folder check FileDialog Property in help. HTH -Satish Arjan wrote: Hi al.. I have a problem.. I placed the question here last week aswell, unfortunatly it did not solve my problem.. Scope: I have a userform where I would like to add some buttons wich open certain adobe PDF files. Furthermore, this project is to be burned on a CD so it can be distributed. My problem are the drive letters.. (diffrent systems, diffrent drive letters..) this is the code i'm using.. _______________ Private Sub CommandButton19_Click() 'open pdf file Dim filelocation As String filelocation = ThisWorkbook.Path _________________ I'm missing the last part where I call the variable filelocation and open the pdf file.. Who can help me out? -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nick,
Sorry to bother you again.. I tried to insert the code, unfortunalty there's a compile-error which states that it expects a rulenumber or a name or a instruction or a instruction-end.. I do have to put the code in the command button sub? Or do I make a mistake? -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** "NickHK" wrote: If you just want to open them in the user's defualt app for pdf files : Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long ShellExecute 0, "open", Thisworkbook.path & "\YourPDF.pdf", "", "", 1 NickHK "Arjan" wrote in message ... Nick, Thanks for your reply.. The files are in the same path as the workbook. However, what I don't know is the how to open the file(s).. what code do I have to use? Arjan -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** "NickHK" wrote: Arjan, Depends where the PDFs are relative to the Excel WB. You already have ThisWorkbook.Path, so if they in a sub folder of that : ThisWorkbook.Path & "\PDF_Folder\PDF1.pdf" If you maybe on Mac then you would need to do bit work at detecting that first. NickHK "Arjan" wrote in message ... Hi al.. I have a problem.. I placed the question here last week aswell, unfortunatly it did not solve my problem.. Scope: I have a userform where I would like to add some buttons wich open certain adobe PDF files. Furthermore, this project is to be burned on a CD so it can be distributed. My problem are the drive letters.. (diffrent systems, diffrent drive letters..) this is the code i'm using.. _______________ Private Sub CommandButton19_Click() 'open pdf file Dim filelocation As String filelocation = ThisWorkbook.Path _________________ I'm missing the last part where I call the variable filelocation and open the pdf file.. Who can help me out? -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nick, sorry to bother you again...
When i put this code in the commandbutton sub it returns a complie error. It suspects a rulenumber, a name an instruction or an instruction end. I do have tp put this code in the commandbutton sub? or do i make a mistake? thanks again for your help! Arjan -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** "NickHK" wrote: If you just want to open them in the user's defualt app for pdf files : Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long ShellExecute 0, "open", Thisworkbook.path & "\YourPDF.pdf", "", "", 1 NickHK "Arjan" wrote in message ... Nick, Thanks for your reply.. The files are in the same path as the workbook. However, what I don't know is the how to open the file(s).. what code do I have to use? Arjan -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** "NickHK" wrote: Arjan, Depends where the PDFs are relative to the Excel WB. You already have ThisWorkbook.Path, so if they in a sub folder of that : ThisWorkbook.Path & "\PDF_Folder\PDF1.pdf" If you maybe on Mac then you would need to do bit work at detecting that first. NickHK "Arjan" wrote in message ... Hi al.. I have a problem.. I placed the question here last week aswell, unfortunatly it did not solve my problem.. Scope: I have a userform where I would like to add some buttons wich open certain adobe PDF files. Furthermore, this project is to be burned on a CD so it can be distributed. My problem are the drive letters.. (diffrent systems, diffrent drive letters..) this is the code i'm using.. _______________ Private Sub CommandButton19_Click() 'open pdf file Dim filelocation As String filelocation = ThisWorkbook.Path _________________ I'm missing the last part where I call the variable filelocation and open the pdf file.. Who can help me out? -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Arjan,
OK, this a bit more correct : Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Private Sub CommandButton1_Click() ShellExecute 0, "open", Thisworkbook.path & "\YourPDF.pdf", "", "", 1 End Sub NickHK "Arjan" wrote in message ... Nick, Sorry to bother you again.. I tried to insert the code, unfortunalty there's a compile-error which states that it expects a rulenumber or a name or a instruction or a instruction-end.. I do have to put the code in the command button sub? Or do I make a mistake? -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** "NickHK" wrote: If you just want to open them in the user's defualt app for pdf files : Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long ShellExecute 0, "open", Thisworkbook.path & "\YourPDF.pdf", "", "", 1 NickHK "Arjan" wrote in message ... Nick, Thanks for your reply.. The files are in the same path as the workbook. However, what I don't know is the how to open the file(s).. what code do I have to use? Arjan -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** "NickHK" wrote: Arjan, Depends where the PDFs are relative to the Excel WB. You already have ThisWorkbook.Path, so if they in a sub folder of that : ThisWorkbook.Path & "\PDF_Folder\PDF1.pdf" If you maybe on Mac then you would need to do bit work at detecting that first. NickHK "Arjan" wrote in message ... Hi al.. I have a problem.. I placed the question here last week aswell, unfortunatly it did not solve my problem.. Scope: I have a userform where I would like to add some buttons wich open certain adobe PDF files. Furthermore, this project is to be burned on a CD so it can be distributed. My problem are the drive letters.. (diffrent systems, diffrent drive letters..) this is the code i'm using.. _______________ Private Sub CommandButton19_Click() 'open pdf file Dim filelocation As String filelocation = ThisWorkbook.Path _________________ I'm missing the last part where I call the variable filelocation and open the pdf file.. Who can help me out? -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nick,
thnx!! works great.. you've been a great help!! -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** "NickHK" wrote: Arjan, OK, this a bit more correct : Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Private Sub CommandButton1_Click() ShellExecute 0, "open", Thisworkbook.path & "\YourPDF.pdf", "", "", 1 End Sub NickHK "Arjan" wrote in message ... Nick, Sorry to bother you again.. I tried to insert the code, unfortunalty there's a compile-error which states that it expects a rulenumber or a name or a instruction or a instruction-end.. I do have to put the code in the command button sub? Or do I make a mistake? -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** "NickHK" wrote: If you just want to open them in the user's defualt app for pdf files : Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long ShellExecute 0, "open", Thisworkbook.path & "\YourPDF.pdf", "", "", 1 NickHK "Arjan" wrote in message ... Nick, Thanks for your reply.. The files are in the same path as the workbook. However, what I don't know is the how to open the file(s).. what code do I have to use? Arjan -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** "NickHK" wrote: Arjan, Depends where the PDFs are relative to the Excel WB. You already have ThisWorkbook.Path, so if they in a sub folder of that : ThisWorkbook.Path & "\PDF_Folder\PDF1.pdf" If you maybe on Mac then you would need to do bit work at detecting that first. NickHK "Arjan" wrote in message ... Hi al.. I have a problem.. I placed the question here last week aswell, unfortunatly it did not solve my problem.. Scope: I have a userform where I would like to add some buttons wich open certain adobe PDF files. Furthermore, this project is to be burned on a CD so it can be distributed. My problem are the drive letters.. (diffrent systems, diffrent drive letters..) this is the code i'm using.. _______________ Private Sub CommandButton19_Click() 'open pdf file Dim filelocation As String filelocation = ThisWorkbook.Path _________________ I'm missing the last part where I call the variable filelocation and open the pdf file.. Who can help me out? -- Arjan Bregman ***** the knowledge is always there, maybe hidden, but it is there.. ***** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Open Dialog Box to return Selected File Path and Not Open it. | Excel Programming | |||
Specify Path / open all files in folder... | Excel Programming | |||
Dynamic directory path | Excel Discussion (Misc queries) | |||
setting a dynamic path in an excel query | Excel Programming | |||
Making path of linked cell dynamic | Excel Discussion (Misc queries) |