Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default excel 2007 macro/vb programing question

Here is an example:
'=============
ActiveWorkbook.SaveAs Filename:= _
sNewItem & "\Template ISO " & sSheetName & " Audit
mm.dd.yy.xlsx", _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False,
WriteResPassword:="xxxx"
'=============
The "_" underscore after "ActiveWorkbook.SaveAs Filename:=" is a row
continuation symbol that lets you break lines into rows. There are
two underscores in this example.
( The symbols and < used to stop confusion of ("") quote usage.

The string sNewItem & "\Template ISO " & sSheetName & " Audit
mm.dd.yy.xlsx"<< means:
sNewItem is a variable (string) that contains the folder path
"\Template ISO " is simply text
sSheetName is a variable for the sheet name
" Audit mm.dd.yy.xlsx" is simply text (spaces intentional in this
case)

My example would create this string: (Assuming sNewItem is "C:
\Myfolder" and sSheetName is "MySheet")
C:\Myfolder\Template ISO MySheet Audit mm.dd.yy.xlsx

If you want to replace a variable with text simply use "" quotes
around the text.
"C:\Myfolder" & "\Template ISO " & "MySheet" & " Audit mm.dd.yy.xlsx"
will create the same result as my example.
C:\Myfolder\Template ISO MySheet Audit mm.dd.yy.xlsx

Also I show the use of password protecting the sheet
(WriteRespassword). Changing "WriteRespassword" to "Password" will
protect the workbook and not the sheet.

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
Excel 2007 Macro/VB Question DDE Question MadDog22 Excel Worksheet Functions 1 March 10th 10 01:47 AM
excel 2007 macro question George Applegate[_2_] Excel Discussion (Misc queries) 1 June 18th 09 03:44 PM
Excel 2007 Macro Question vtec Excel Discussion (Misc queries) 4 April 19th 07 02:14 PM
Excel 2007...what is the main programing tool RAJ Excel Discussion (Misc queries) 2 March 17th 07 11:52 PM
excel question borderline programing gimp New Users to Excel 1 June 25th 06 06:01 AM


All times are GMT +1. The time now is 05:40 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"