Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Embedding VBA (Excel) Variable in Strings

Posted on 2007-03-23
2
Medium Priority
?
618 Views
Last Modified: 2013-12-26
How does one go about embedding a variable, i.e. below I try  to save successive worksheets to a folder.  How do I assign the protein name in the FOR loop to the destination filename with the .txt extension below?

Dim Protein As Variant
Protein = Array("PRAF", "PMEK", "PLC", "PIP2", "PIP3", "ERK", "AKT", "PKA", "PKC", "P38", "PJNK")

For i = 0 To UBound(Protein)

    Sheets(Protein(i)).Select
    ChDir "C:\Documents and Settings\yiprobpat2003\Desktop\Thesis\Comparisons"
    ActiveWorkbook.SaveAs Filename:= _
        "C:\Documents and Settings\yiprobpat2003\Desktop\Thesis\Comparisons\PLC.txt", _
        FileFormat:=xlTextMSDOS, CreateBackup:=False
Next

Thanks again for the help.

Jason
0
Comment
Question by:cdromes
[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
2 Comments
 
LVL 4

Accepted Solution

by:
g_johnson earned 200 total points
ID: 18782145
ActiveWorkbook.SaveAs Filename:= _
        "C:\Documents and Settings\yiprobpat2003\Desktop\Thesis\Comparisons\" & Protein(i) & ".txt", _
        FileFormat:=xlTextMSDOS, CreateBackup:=False
0
 

Author Comment

by:cdromes
ID: 18785046
Great!  Thanks.
0

Featured Post

Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

Question has a verified solution.

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

Windows Server 2003 introduced persistent Volume Shadow Copies and made 2003 a must-do upgrade.  Since then, it's been a must-implement feature for all servers doing any kind of file sharing.
IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

688 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