Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default changing file names with macros


Can anyone help me with this code

What i'm trying to do is get the last 3 letter of the file name ie AWE
to be replaced with
what is in a selected cell. In this case A32
please help

Sub update()

Range("A32").Select
franking = ActiveCell.FormulaR1C1

'ActiveCell.FormulaR1C1 = _
"='[Reuters Contribution fields_AWE.xls]Estimates'!R29C2"

End Sub


--
trevor@OML
------------------------------------------------------------------------
trevor@OML's Profile: http://www.excelforum.com/member.php...o&userid=29503
View this thread: http://www.excelforum.com/showthread...hreadid=492083

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default changing file names with macros

Maybe you could look for .xls] and back off from there?

Option Explicit

Sub update()
Dim Franking As String
Dim NewFranking As String
Dim NewText As String
Dim DotXLSPos As Long

Franking = Range("a32").FormulaR1C1
NewText = Range("a1").Value

''' Franking = "='[Reuters Contribution fields_AWE.xls]Estimates'!R29C2"

DotXLSPos = InStr(1, Franking, ".xls]", vbTextCompare)

If DotXLSPos = 0 Then
MsgBox "not found"
Else
NewFranking = Left(Franking, DotXLSPos - 5 + 1) _
& NewText & Mid(Franking, DotXLSPos)
MsgBox NewFranking
End If

End Sub

An alternative...

You may want to record a macro when you change links
edit|links
and use that technique instead.

"trevor@OML" wrote:

Can anyone help me with this code

What i'm trying to do is get the last 3 letter of the file name ie AWE
to be replaced with
what is in a selected cell. In this case A32
please help

Sub update()

Range("A32").Select
franking = ActiveCell.FormulaR1C1

'ActiveCell.FormulaR1C1 = _
"='[Reuters Contribution fields_AWE.xls]Estimates'!R29C2"

End Sub

--
trevor@OML
------------------------------------------------------------------------
trevor@OML's Profile: http://www.excelforum.com/member.php...o&userid=29503
View this thread: http://www.excelforum.com/showthread...hreadid=492083


--

Dave Peterson
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
Changing font or Adding color to file names Rich Excel Discussion (Misc queries) 2 October 23rd 08 04:34 PM
changing file extention names David Excel Discussion (Misc queries) 1 November 9th 07 02:41 AM
changing file names saybut Excel Discussion (Misc queries) 2 February 20th 06 03:49 PM
Changing File Names and Linking Cells between workbooks James Excel Programming 1 November 19th 05 12:39 AM
multiple file names in macros tfcc Excel Programming 3 July 9th 05 06:27 PM


All times are GMT +1. The time now is 03:13 PM.

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"