Save document with table cell value in filename


"Excel VBA Help"

 


Play Friv Now - Play Friv Games
Go Back   The Code Cage Forums > Microsoft Topics > Microsoft Word Forum
Our Info Pages:-
The Code Cage - Microsoft Office help

Notices

Microsoft Word Forum Members, post questions in this forum if they are related to using Microsoft Word, this includes Document Properties, VBA Programming & Functionality etc.

New Reply
Thread Tools Rate Thread Display Modes
  #1  
Unread 26th February 2014, 21:17
sharky12345's Avatar
sharky12345 sharky12345 is offline
Junior Member
MS Office Version: MS Office 97, 2003, 2007,2010
MS Office Skill Level: Some VBA experience
 
Join Date: Oct 2013
Location: UK
Posts: 54
Posts Per Day: 0.04
My Top Tip Count: 0
Thanks to others: 0
Thanked 0 Times in 0 Posts
Reputation: 10 (4) sharky12345 is on a distinguished road
Default Save document with table cell value in filename
     Word: VBA   


------ Register to get rid of these "In Post" ads! ------

Category: Word: VBA   

I'm trying to get this to work but it won't because of paragraph marks that are appearing in the table which means that the IF criteria is never met;

VBA CODE:
If txtAltar.Text = "Altar" Then 
    ActiveDocument.Unprotect Password:="383456" 
    ActiveDocument.SaveAs ActiveDocument.Path & "\Return - " & txtAltar.Text & ".doc" 
    ActiveDocument.Protect Password:="383456", NoReset:=False, Type:= _ 
    wdAllowOnlyReading, UseIRM:=False, EnforceStyleLock:=False 
End If 

Is there a way I can specify something like if the Textbox is not empty, like you can with Excel?

The Code Cage Advertisment
Advertisement

To stop seeing these ads and get other benefits check This page!

  #2  
Unread 27th February 2014, 10:40
broro183's Avatar
broro183 broro183 is offline
The Code Cage Staff
MS Office Version: Excel 2007 @ home & 2010 @ work
MS Office Skill Level: Can use VBA
 
Join Date: May 2009
Location: Waikato, New Zealand
Posts: 742
Posts Per Day: 0.26
My Top Tip Count: 0
Thanks to others: 15
Thanked 50 Times in 50 Posts
Reputation: 801 (23) broro183 is a splendid one to beholdbroro183 is a splendid one to beholdbroro183 is a splendid one to beholdbroro183 is a splendid one to beholdbroro183 is a splendid one to beholdbroro183 is a splendid one to beholdbroro183 is a splendid one to behold
New_Zealand
Default Re: Save document with table cell value in filename

------ Register to get rid of these "In Post" ads! ------


hi Sharky,

Does the below code work as a new If statement?
VBA CODE:
If Replace(txtAltar.Text, Chr(13), vbNullString) = "Altar" And Len(txtAltar.Text) > 0 Then 

If it doesn't work...
Why not add a File?
Providing a file for your particular application will not only get you your answer quicker but will better illustrate your problem, usually when we can see your data (it can be dummy data but must be of the same type) and your structure it is far easier for us to give you a tailored, workable answer to your query

hth
Rob
__________________
Rob Brockett. Always learning & the best way to learn is to experience...

  #3  
Unread 28th February 2014, 09:41
sharky12345's Avatar
sharky12345 sharky12345 is offline
Junior Member
MS Office Version: MS Office 97, 2003, 2007,2010
MS Office Skill Level: Some VBA experience
 
Join Date: Oct 2013
Location: UK
Posts: 54
Posts Per Day: 0.04
My Top Tip Count: 0
Thanks to others: 0
Thanked 0 Times in 0 Posts
Reputation: 10 (4) sharky12345 is on a distinguished road
Default Re: Save document with table cell value in filename

------ Register to get rid of these "In Post" ads! ------


Thank you - I'll try it!

The Code Cage Advertisment
Advertisement
  #4  
Unread 8th March 2014, 10:45
sharky12345's Avatar
sharky12345 sharky12345 is offline
Junior Member
MS Office Version: MS Office 97, 2003, 2007,2010
MS Office Skill Level: Some VBA experience
 
Join Date: Oct 2013
Location: UK
Posts: 54
Posts Per Day: 0.04
My Top Tip Count: 0
Thanks to others: 0
Thanked 0 Times in 0 Posts
Reputation: 10 (4) sharky12345 is on a distinguished road
Default Re: Save document with table cell value in filename

------ Register to get rid of these "In Post" ads! ------


Works great - thanks!

  #5  
Unread 9th March 2014, 10:33
broro183's Avatar
broro183 broro183 is offline
The Code Cage Staff
MS Office Version: Excel 2007 @ home & 2010 @ work
MS Office Skill Level: Can use VBA
 
Join Date: May 2009
Location: Waikato, New Zealand
Posts: 742
Posts Per Day: 0.26
My Top Tip Count: 0
Thanks to others: 15
Thanked 50 Times in 50 Posts
Reputation: 801 (23) broro183 is a splendid one to beholdbroro183 is a splendid one to beholdbroro183 is a splendid one to beholdbroro183 is a splendid one to beholdbroro183 is a splendid one to beholdbroro183 is a splendid one to beholdbroro183 is a splendid one to behold
New_Zealand
Default Re: Save document with table cell value in filename

------ Register to get rid of these "In Post" ads! ------


Great, I'm pleased I could help. Thanks for marking the thread as solved :-)
__________________
Rob Brockett. Always learning & the best way to learn is to experience...

The Code Cage Advertisment
Advertisement

To stop seeing these ads and get other benefits check This page!

New Reply
The Code Cage at Facebookhe Code Cage at Twitter


Tags
cell, document, filename, save, table

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

The Code Cage Affilliates



http://www.thecodecage.com/forumz tested by McAfee Security http://www.thecodecage.com/forumz tested by McAfee Security

All times are GMT +1. The time now is 08:19.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Template-Modifications by TMS
No part of this board, functionality or creatives may be copied or reproduced either in part or full without the express permission of The Code Cage Team.
Copyright ©2008 - , Simon lloyd.
We are not associated with nor employed by Microsoft in any way, we simply provide resources!
All MS office icons are registered trademarks of the application they represent and are used with permission from Microsoft
UA-8135493-1
Cultural Forum | Study at Malaysian University