VB Code issue

mbergstr

New Member
Joined
Dec 11, 2013
Messages
13
I have this code on multiple modules:
'---Get Short Filename cShortFileName = GetFileName(aSelections(General.nReqNo, 4))
'---Check for a trailing period and xls
cShortFileName = GetShortFileName(cShortFileName)
'---Set Page Setup and Print Area
InsertHeaderFooter()

The InsertHeaderFooter() function jumps to a general module and inserts a standard footer which includes cShortFileName:

.RightFooter =
"&6Created On " & Now & _
iif(General.lUseFullName,
" by " & cFullUserName, " (" & cFullUserName & ")") & Chr(13) & _
aSystemSettings(14, 2) & _
iif(General.lShowRequestNumber, Chr(13) &
"Request # " & aRequestInfo(General.nReqNo, 1), "") & Chr(13) & _ "&7 " & cShortFileName
I use this same code for multiple modules and they work except for one. When the InsertHeaderFooter() line is executed, cShortFileName turns to blank and the footer does not include this field. I'm not sure why it works correctly for all modules except for one?

Any help would be much appreciated. Thanks!


 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Is it a question on VB or VBA?
 
Upvote 0
This is an Excel VBA forum, so you will need to be lucky that someone with that knowledge picks up the topic.
 
Upvote 0

Forum statistics

Threads
1,214,422
Messages
6,119,396
Members
448,891
Latest member
tpierce

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top