Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default open xls macro

Hello Gurus and newsgroup users.

Your assistance please.

I am trying to create a macro that will open a .xls at
specific location on the server.


I have part of the file name within a cell on a separate
spreadsheet.


I.e. cell A12 value equals QQ3E. The file I wish to open
is called QQ3E.xls.


Any help you can provide would be appreciated.


My apologise if I have posted the message in the wrong
newsgroup.


PW

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default open xls macro

Assume you want to use a UNC path to get to the file and you know what the
UNC path is.

Dim sName as String
sName = Thisworkbook.worksheets(1).Range("A12").Value
if instr(sName,".xls") = 0 then
sName = sName & ".xls"
End if
sPath = "\\LOGFS03\OGILVTW\Docs"
workbooks.Open sPath & "\" & sName

--
Regards,
Tom Ogilvy



"PaulW" wrote in message
...
Hello Gurus and newsgroup users.

Your assistance please.

I am trying to create a macro that will open a .xls at
specific location on the server.


I have part of the file name within a cell on a separate
spreadsheet.


I.e. cell A12 value equals QQ3E. The file I wish to open
is called QQ3E.xls.


Any help you can provide would be appreciated.


My apologise if I have posted the message in the wrong
newsgroup.


PW



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default open xls macro

Tom that works a treat.

Thank you.

Could you tell me Tom, if it would be possible to have a
wild card in the file search. This is because some cells
dont have the complete filename.
ie A12 = "12234" and the file name is "12234bob"

Once again thank you for your time.


Regards
PW
-----Original Message-----
Assume you want to use a UNC path to get to the file and

you know what the
UNC path is.

Dim sName as String
sName = Thisworkbook.worksheets(1).Range("A12").Value
if instr(sName,".xls") = 0 then
sName = sName & ".xls"
End if
sPath = "\\LOGFS03\OGILVTW\Docs"
workbooks.Open sPath & "\" & sName

--
Regards,
Tom Ogilvy



"PaulW" wrote in message
...
Hello Gurus and newsgroup users.

Your assistance please.

I am trying to create a macro that will open a .xls at
specific location on the server.


I have part of the file name within a cell on a separate
spreadsheet.


I.e. cell A12 value equals QQ3E. The file I wish to open
is called QQ3E.xls.


Any help you can provide would be appreciated.


My apologise if I have posted the message in the wrong
newsgroup.


PW



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default open xls macro

This will get the first file that starts with the string in A12

Sub PartialName()
Dim sName As String
Dim sName1 As String
sName = ThisWorkbook.Worksheets(1).Range("A12").Value
sPath = "\\LOGFS03\OGILVTW\Docs"
sName1 = Dir(sPath & "\" & sName & "*.xls")
If sName1 < "" Then
Workbooks.Open sPath & "\" & sName1
Else
MsgBox "Nothing found for " & sPath & "\" & _
sName & "*.xls"
End If
End Sub


--
Regards,
Tom Ogilvy

"PaulW" wrote in message
...
Tom that works a treat.

Thank you.

Could you tell me Tom, if it would be possible to have a
wild card in the file search. This is because some cells
dont have the complete filename.
ie A12 = "12234" and the file name is "12234bob"

Once again thank you for your time.


Regards
PW
-----Original Message-----
Assume you want to use a UNC path to get to the file and

you know what the
UNC path is.

Dim sName as String
sName = Thisworkbook.worksheets(1).Range("A12").Value
if instr(sName,".xls") = 0 then
sName = sName & ".xls"
End if
sPath = "\\LOGFS03\OGILVTW\Docs"
workbooks.Open sPath & "\" & sName

--
Regards,
Tom Ogilvy



"PaulW" wrote in message
...
Hello Gurus and newsgroup users.

Your assistance please.

I am trying to create a macro that will open a .xls at
specific location on the server.


I have part of the file name within a cell on a separate
spreadsheet.


I.e. cell A12 value equals QQ3E. The file I wish to open
is called QQ3E.xls.


Any help you can provide would be appreciated.


My apologise if I have posted the message in the wrong
newsgroup.


PW



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default open xls macro

No, but there are loads of them.

go to
http://www.mvps.org/links.html

and look in the Excel section.

--
Regards,
Tom Ogilvy


"PaulW" wrote in message
...
Tom I cannot thank you enough.

You have saved me hours & hours of work.

Do you have a Excel website.

Thank you again

Regards

A very happy newsgroup user.
Paul




Reply
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
Open Excel file from VB and open MACRO no1jimmyman Excel Discussion (Misc queries) 0 February 14th 11 10:10 PM
Run macro at open KJ Excel Discussion (Misc queries) 2 February 28th 08 04:39 PM
Run on open macro JaB Excel Worksheet Functions 1 January 23rd 07 12:54 PM
Macro - Open Word with Excel macro Bill Excel Discussion (Misc queries) 3 May 23rd 05 11:21 PM
How do I get my personal macro worksheet to open whenever I open . Claudia_R Excel Discussion (Misc queries) 3 December 9th 04 11:59 PM


All times are GMT +1. The time now is 04:28 AM.

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

About Us

"It's about Microsoft Excel"