Solved

Embedding VBA (Excel) Variable in Strings

Posted on 2007-03-23
2
615 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 50 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

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

An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

630 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