Solved

Use data to create Hyperlink..?

Posted on 2000-03-14
8
168 Views
Last Modified: 2010-05-02
I want to know how it is possible to insert a search for a specific file.  At the moment I have a hyperlink to an Excel file called C:\Test\Test_01_01_2000.xls and another C:\Test\Test_02_01_2000.xls, basically every day a new file is created in the format. Test(filename)_01(day)_02(month)_2000(year).  What i would like to accomplish is to insert something like 3 text boxes on my form called ,day ,month and year.  Once the user inserted the data in the text boxes and you click the Submit button it should point to the relevant hyperlink. For example in the text box Day the user inserted 05 and the textbox month the user inserted 03 and textbox year the user inserted 2000, once inserted and you click the submit button the the results should the point to C:\Test\Test_05_03_2000.xls
0
Comment
Question by:fouchev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 2615464
What are you using to create your hyperlink? The hyperlink will normally take the form of a string:

"file://c:/test/test_01_01_2000.xls" this could easily be built up as you describe.
0
 
LVL 1

Author Comment

by:fouchev
ID: 2615466
Edited text of question.
0
 
LVL 1

Author Comment

by:fouchev
ID: 2615477
Edited text of question.
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 1

Author Comment

by:fouchev
ID: 2615498
Very quick there Tim,

Well at the moment the the hyperlink is under the properties of a command button called btnSubmit. Once I change the data in the text boxes, i need the hyperlink in the button properties to change accordingly.  Is this clearer?
0
 
LVL 2

Accepted Solution

by:
gelog earned 50 total points
ID: 2615676
Why do you use textboxes for date input? It is more elegant solution to use DateTimePicker (Calendar) Control.

Include to a project Windows Common Controls - 2. Place the DateTimePicker on the form, also add the button control.

Insert the following code to the from code module:

Private Sub Command1_Click()
    MsgBox Command1.Tag
End Sub

Private Sub DTPicker1_Change()
   
    With DTPicker1
        Command1.Tag = "C:\Test_" & Day(.Value) & _
            "_" & Month(.Value) & "_" & Year(.Value) & ".xls"
    End With
           
End Sub

Run the project, click on the buuton, you sould see the result in a message box.

0
 
LVL 43

Expert Comment

by:TimCottee
ID: 2615726
Are you using a DHTML project, VB Script or ActiveX document model to do this with? Gelog's comment is possibly helpful as it may well be a nicer interface to go with, however you would still have to format the date parts correctly to get "01" instead of "1" for the day and month.

0
 
LVL 1

Author Comment

by:fouchev
ID: 2619966
Hi again,
I works fine, it displays in the message box, but how do get it to go to the file (hyperlink) now. Must one put code behind the Ok button or what..?  
0
 
LVL 2

Expert Comment

by:gelog
ID: 2620073
Insert in the Global_Declarations section of the form code module the following API declaration:

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

In the Command1_Click event procedure insert the call of ShellExecute instead of the call of MsgBox:


ShellExecute 0&, "Open", Command1.Tag, 0&, 0&, 1&
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
vbModal 12 74
RUNRMTCMD from AS/400 13 129
VBA- How to change font, color and format in outlook e-mail sent from Access 2 173
2 Global Vars, 1 List Box 4 33
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question