LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Opening a file through input of first 3 digits

Hi all,

with some help (!) I managed to have a .doc file to open after
running a macro with a given input in a cell.

For instance:

cell b2 hs the value 101

Now after selecting the cell (B2) and running the macro.
The file 101_document will be opened.


However: the "_document" part is a random name.
My list of files looks a bit like this:

101_smith_retail
102_Johnson_hardware
103_Kelly_cycles

How can I open a file after input?

So the line: strFilename = "_document.doc"
should be more like: strFilename = random_name ????




Sub test()
'Dim MyFile As String

Dim wdapp As Object
strFilename = "_document.doc"
Set wdapp = CreateObject("Word.Application")
With wdapp
.Documents.Open Filename:="C:\" & ActiveCell.Value & strFilename
.Visible = True
End With
Set wdapp = Nothing
End Sub



I hope my description is clear enough for you to understand what i'm
looking for?


Thanks in advance for your help, Theo


--
Greetz, Just4fun
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
after opening existing spreadsheet can't input data anymore rls Excel Worksheet Functions 2 October 6th 08 03:36 AM
Opening a file with User Input [email protected] Excel Discussion (Misc queries) 3 March 28th 07 03:00 AM
opening an excel file opens a duplicate file of the same file skm Excel Discussion (Misc queries) 1 December 7th 05 05:52 PM
Opening a template form & renaming it from a cell input automatica John Galt Excel Discussion (Misc queries) 0 April 19th 05 09:16 PM
Opening a text file for input [email protected] Excel Programming 5 January 8th 04 05:11 AM


All times are GMT +1. The time now is 07:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"