Hello,
Would like to use Shell "Explorer.exe " to replace HyperlinkAddress in order to open the document in File Explorer, but don't know how to use it in my coding because the HyperlinkAddress would pop up a security warning box and the Shell "Explorer.exe " will just open the document directly. Any help would be very appreciated!
Attached is the screen shot of the form, when users click on the View Order(s) then opens the form list all the pdf associate with that OrderNo , so that users know how many orders under this orderNo and they can select which one they want to view.
Here is my code
	
	
	
		
		
		
	
	
		 
	
My main point is to avoid to click "Yes" every time in order to open the document. But can't figure where to place the Shell "Explorer.exe " with Me(1).HyperlinkAddress also use Shell "Explorer.exe " replace Me(ControlCount).HyperlinkAddress . I did try Shell "Explorer.exe " & Environ("Userprofile") & "\OneDrive\Orders\" & HoldYear & "\" & Holddate & "\" & stFileName but it opens all the pdf s at the same time which is not what I want.
Thank you,
 Would like to use Shell "Explorer.exe " to replace HyperlinkAddress in order to open the document in File Explorer, but don't know how to use it in my coding because the HyperlinkAddress would pop up a security warning box and the Shell "Explorer.exe " will just open the document directly. Any help would be very appreciated!
Attached is the screen shot of the form, when users click on the View Order(s) then opens the form list all the pdf associate with that OrderNo , so that users know how many orders under this orderNo and they can select which one they want to view.
Here is my code
		Code:
	
	
	Private Sub Form_Open(cancel As Integer)
    Dim Holddate as string
    Dim HoldYear as String
    Dim stFileName as String
    Dim ControlCount as Integer
    Dim GetControlName As String
Holddate = Format(Form_frmOrder.Orderdate,"mm") & "-" & Format(Form_frmOrder.Orderdate,"dd") & "-" & format(Form_frmOrder.Orderdate, "yy")
HoldYear = format(Form_frmOrder.Orderdate, "yyyy")
stFileName = Dir("Environ("Userprofile") & "\OneDrive\Orders\" & HoldYear & "\" & Holddate & "\" & Form_frmOrder.OrderNo & "*.pdf")
Me(1).Caption = stFileName
Me(1).HyperlinkAddress = "Environ("Userprofile") & "\OneDrive\Orders\" & HoldYear & "\" & Holddate & "\" & stFileName
ControlCount = 2
stFileName = Dir
Do Until stFileName = ""
Me(ControlCount).Caption = stFileName
Me(ControlCount).HyperlinkAddress = "Environ("Userprofile") & "\OneDrive\Orders\" & HoldYear & "\" & Holddate & "\" & stFileName
ControlCount = ControlCount+1
stFileName = Dir
Loop
End SubMy main point is to avoid to click "Yes" every time in order to open the document. But can't figure where to place the Shell "Explorer.exe " with Me(1).HyperlinkAddress also use Shell "Explorer.exe " replace Me(ControlCount).HyperlinkAddress . I did try Shell "Explorer.exe " & Environ("Userprofile") & "\OneDrive\Orders\" & HoldYear & "\" & Holddate & "\" & stFileName but it opens all the pdf s at the same time which is not what I want.
Thank you,
			
				Last edited: 
			
		
	
								
								
									
	
		
			
		
		
	
	
	
		
			
		
		
	
								
							
							 
	 
 
		 
 
		 
 
		 
 
		 
 
		